powerbi how to avoid circular dependency error - powerbi

I've tried add calculated column to my table in power bi. Now I have two columns:
Num_of_occurence=CALCULATE(COUNT(Loans[ID]))
which calculates how may times specific loan occurs in this table
Num_of_all_loans=COUNTROWS(Loans)
calculation of number of all loans in table. What I've tried to add is calculated column which calculated percentage
Percent=DIVIDE([Num_of_occurence];[Num_of_all_loans])
The proble is I got circular dependency error. Any idea how to solve it?

You don't need calculated Filed rather you need Measure.
Use the same formula but rather than calculated column create Measure and you shall have your result
Column = CALCULATE(DIVIDE([No of Occurence];[Num_of_all_loans]))

Making a measure solved the problem for it! Thanks.
Measure 1 = CALCULATE(VALUES('All Rates_OTM'[SCAC]))
Measure 2 = CALCULATE(VALUES('All Rates_OTM'[SCAC]))
Comparison calculated column:
IsPreferredCarrier = IF('Table 1'[Measure 1] = 'Table 2'[Measure 2], "Yes", "No")

Related

DAX - CALCULATING MAX Value of MEASURE in filtered Context

I have an issue that I am trying to solve with no luck yet
I have a table to which I have to calculate Max value of a MEASURE in overall report Context
Here is attached sample of data and a result that I should get
A measure for "Sum of NUM":
Sum of NUM:=SUM(Data[NUM])
I've tried maxx function in different variations, the best I am getting the same value as a total
Maxx_calc Measure:
Maxx_Calc:=MAXX(SUMMARIZE('Data','Date'[Year],"Total Date Qty", SUM(Data[NUM])),[Total Date Qty])
However the needed result is in the last column, I just can't get that calculation
any help will be much apreciated!
thanks in advance
Measure = CALCULATE(SUM(_tx[val]),FILTER(_tx,_tx[cat ]="test"))
Measure 2 = CALCULATE(MAXX(GROUPBY(FILTER(_tx,_tx[cat ]="test"),_tx[p],"x",SUMX(CURRENTGROUP(),_tx[val])),[x]),ALL(_tx[p]))

Can we calculate a measure with percentage in Power BI matrix

Can we create a percentage measure in power BI over a matrix visual.
You can create a measure in your table using DAX below -
% Percentage = DIVIDE([1],[0])
Then change the format of [% Percentage] to percentage
You can create this below measure-
%percentage = DIVIDE(your_table_name[1],your_tabl_name[0])
Now change the Type of the Measure as % from the top menu.
Try this, if it helps. I am throwing blank if denominator is blank else it's value will become invalid:
Create a measure and append that next to your matrix.
Measure = IF(COUNT(Sheet1[Denominator])<COUNT(Sheet1[Numerator]), BLANK(), DIVIDE(SUM(Sheet1[Numerator]), SUM(Sheet1[Denominator])))
Later you can change formatting from right side, below visualization, where you see small dropdowns next to column/row/values names > Show values as.
Let me know if it solves your problem.

Calculated column in Power BI based on relationship between 2 tables

Hi,
I'm trying to add a calculated column in my MergedTable table that will multiply the Time column by the sum of the indicator in the TeamLeave when the week ending dates and the name dates are the same but I'm not sure how or what functions to use(I've tried a number at this stage).
Could anyone provide me with assistance on this?
Thanks,
This:
'MergedTable'[Time] * CALCULATE(SUM('Team Leave'[Indicator]))
The CALCULATE is necessary to perform a context transition (turning the "current row" of 'MergedTable' into a filter that will propagate to the 'Team Leave' table).

Cumulative Values row wise and with date filter minimum and maximum in DAX(Power BI)

I need help in calculating the cumulative frequencies row wise with minimum date and maximum date selection by users using sliders. Here is the table that I want to generate could you please guide me? I've tried various function and methods but nothing is giving me right answer. Thanks a lot in advance.
Below is the table that I've and I want to generate:
Original Table
Desired Table
To create a running total, create a new measure in your table like this (where Table is the name of your table):
Running Total = CALCULATE(
SUM('Table'[Values]);
FILTER(ALLSELECTED('Table'); 'Table'[Date] <= SELECTEDVALUE('Table'[Date]))
)

How to sum a column filtered by a categorical column in the same table in Power Bi?

I'm trying to get a sum of my sales figures by the product category from the a column in the same table
The original data is on the attached image.
Original Data
And what I'm trying to get is attached also and I am having trouble getting the right numbers for the last three columns
Result
I have tried the following code:
Boots_Sales = CALCULATE( SUM(Sheet1[Sales]), FILTER(Sheet1,Sheet1[Product_Type]="Boots"))
I have found a solution to the above by making a measure instead of a column with the below formula:
boot1 = CALCULATE(SUM(original[Sales]),FILTER(original,original[Product type ]="Boots"))
This will have to do, I was trying to make a column because I wanted to do further calculations on the column but will just have to convert the measure into a column
Thanks