Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.
I have a measure like this in a table where Amount is a column and Measure1 is measure
Measure = if([Measure1]="Yes",CALCULATE(SUM([Amount])))
It's not showing the Totals in the table, Totals is blank
I tried CALCULATE(SUM([Amount]),[Measure1]="Yes")
but it's giving error-A function 'PLACEHOLDER' has been used in a True/False expression that is used as a table filter expression. This is not allowed.
How can I correct it?
Solved! Go to Solution.
Hi @bml123 ,
I think you can try this code to create a measure.
Measure2 = CALCULATE(SUM('Table'[Difference])+0,FILTER('Table',[Measure1] = "Yes"))
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@bml123 You should stick with V1: if([Measure1]="Yes",CALCULATE(SUM([Amount]))) but you need to see why this measure is not equal to "Yes" fot the total and fix it. If you can't then maybe best to share a sample file or data (not screenshots)
HI @SpartaBI
I have data like this
Current | Next Month | Difference | % change | Measure1 |
100 | 60 | 40 | 40.00% | No |
50 | 30 | 20 | 40.00% | No |
20 | 19.75 | 0.25 | 1.25% | Yes |
30 | 29.5 | 0.5 | 1.67% | Yes |
60 | 20 | 40 | 66.67% | No |
where Measure1 is a measure to flag if the percentage is within -2% to 2%. I want to add the
'Difference 'column where meaure 1 is Yes. It's showing the numbers in the table but totals is 0.
Here is the desired output
Current | Next Month | Difference | % change | Measure1 | Measure |
100 | 60 | 40 | 40.00% | No | 0 |
50 | 30 | 20 | 40.00% | No | 0 |
20 | 19.75 | 0.25 | 1.25% | Yes | 0.25 |
30 | 29.5 | 0.5 | 1.67% | Yes | 0.5 |
60 | 20 | 40 | 66.67% | No | 0 |
Total | 0.75 |
Hi @bml123 ,
I think you can try this code to create a measure.
Measure2 = CALCULATE(SUM('Table'[Difference])+0,FILTER('Table',[Measure1] = "Yes"))
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@bml123 ok , so you need to wrap your measure with SUMX.
Try first something like:
SUMX('Table', if([Measure1]="Yes",CALCULATE(SUM([Amount]))))
Hi @SpartaBI
It's not the sum of Amount I want, it's the sum of Difference column.
As per your suggestion, I tried
SUMX('Table', if([Measure1]="Yes",Difference))
It didn't work, it gave the total of all the data ignoring Measure1=Yes
Hi @SpartaBI
Sorry, can't share the file as it has confidential data.
I have given you the sample data above.
Check out the November 2023 Power BI update to learn about new features.
Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.
Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!