Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Category of graph

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!

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1649211100422.png

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)

vyangliumsft_1-1649211100424.png

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:

vyangliumsft_2-1649211100426.png

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

View solution in original post

3 REPLIES 3
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1649211100422.png

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)

vyangliumsft_1-1649211100424.png

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:

vyangliumsft_2-1649211100426.png

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

v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1649044542562.png

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:

vyangliumsft_1-1649044542563.png

 

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

Anonymous
Not applicable

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!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.