Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I have a bar chart with categories A, B, C. Is there a way to apply a special calculation when the chart category is C? Something like a measure that when it detects that the category shown is C, it applies a calculation. I had thought about applying the selectedvalue() formula but it is not the appropriate one. I am building a waterfall and I need one of the categories to be a computation of another. Thanks!
Solved! Go to Solution.
Hi @Anonymous ,
I created some data:
This data needs to be in the original data column to display, you can create a new table to add it.
Custom rules:
When Category is A or B, find the amount of each group
When Category is C, find the sum of the amount of group A and the amount of group B
When Category is D, find the sum of the amount in Group B and the amount in Group CHere are the steps you can follow:
1. Create calculated table.
Ap_Table =
var _summarize =
SUMMARIZE(
'Table1',
[Date],
"Group","D",
"amount",CALCULATE(SUM('Table1'[amount]),FILTER(ALL('Table1'),'Table1'[Group] in {"B","D"})
))
return
UNION('Table1',_summarize)
2. Create measure.
Flag =
SWITCH(
TRUE(),
MAX('Ap_Table'[Group])in{"A","B"},CALCULATE(SUM('Ap_Table'[amount]),FILTER(ALL('Ap_Table'),'Ap_Table'[Group]=MAX('Ap_Table'[Group]))),
MAX('Ap_Table'[Group]) in{"C"},CALCULATE(SUM('Ap_Table'[amount]),FILTER(ALL('Ap_Table'),'Ap_Table'[Group] in {"A","B"})),
MAX('Ap_Table'[Group]) in{"D"},MAXX(FILTER( ALL(Ap_Table),'Ap_Table'[Group]="D"),[amount]))
3. Result:
Please click here for the pbix file
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @Anonymous ,
I created some data:
This data needs to be in the original data column to display, you can create a new table to add it.
Custom rules:
When Category is A or B, find the amount of each group
When Category is C, find the sum of the amount of group A and the amount of group B
When Category is D, find the sum of the amount in Group B and the amount in Group CHere are the steps you can follow:
1. Create calculated table.
Ap_Table =
var _summarize =
SUMMARIZE(
'Table1',
[Date],
"Group","D",
"amount",CALCULATE(SUM('Table1'[amount]),FILTER(ALL('Table1'),'Table1'[Group] in {"B","D"})
))
return
UNION('Table1',_summarize)
2. Create measure.
Flag =
SWITCH(
TRUE(),
MAX('Ap_Table'[Group])in{"A","B"},CALCULATE(SUM('Ap_Table'[amount]),FILTER(ALL('Ap_Table'),'Ap_Table'[Group]=MAX('Ap_Table'[Group]))),
MAX('Ap_Table'[Group]) in{"C"},CALCULATE(SUM('Ap_Table'[amount]),FILTER(ALL('Ap_Table'),'Ap_Table'[Group] in {"A","B"})),
MAX('Ap_Table'[Group]) in{"D"},MAXX(FILTER( ALL(Ap_Table),'Ap_Table'[Group]="D"),[amount]))
3. Result:
Please click here for the pbix file
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @Anonymous ,
I created some data:
Custom rules:
When Category is A or B, find the amount of each group
When Category is C, find the sum of the amount of group A and the amount of group B
Here are the steps you can follow:
1. Create measure.
Measure =
IF(
MAX('Table'[Category])in{"A","B"},CALCULATE(SUM('Table'[amount]),FILTER(ALL('Table'),'Table'[Category]=MAX('Table'[Category]))),
CALCULATE(CALCULATE(SUM('Table'[amount]),FILTER(ALL('Table'),'Table'[Category] in {"A","B"}))
))
2. Result:
Please click here for the pbix file
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Thanks for the reply. And it's possible to create a new category "D" that doesn't exists in the data table with a calculation and show it in the waterfall?
Thanks a lot!