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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Urgent please - Delta on 2 scenarios

Hi, 

 

I have the data in a table called RawData in this format:

ScenarioFunctionMetric
AAA10
AAA20
AAB10
BAA30
BAB40
BAB10

and I will want to retrieve 2 matrix tables displayed like this:

One that is based on a slicer where scenario = A on this format

FunctionSum of scenario ADelta of selected scenarios in selected slicers
AA300
AB10-40

One that is based on a slicer where scenario = B on this format

 Sum of scenario B
AA30
AB50

 

Can you, please, support on this?

Many thanks!

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Sorry I misunderstood your needs before, please try this MEASURE:

Delta of selected scenarios in selected slicers = 
var _a = SUMMARIZE('Table','Table'[Function],"Metric",SUM('Table'[Metric]),"Metric2",CALCULATE(SUM('Table'[Metric]),FILTER(ALL('Table'),[Function]=EARLIER('Table'[Function])&&[Scenario] =SELECTEDVALUE('For slicer'[Scenario]))))
return 
SUMX(_a,[Metric]-[Metric2])

 Output:

vjianbolimsft_0-1675215459121.png

vjianbolimsft_1-1675215470602.png

Best Regards,

Jianbo Li

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

6 REPLIES 6
v-jianboli-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please try:

Measure =
IF (
    ISINSCOPE ( 'Table'[Scenario] ),
    SUM ( 'Table'[Metric] ),
    CALCULATE ( SUM ( 'Table'[Metric] ), FILTER ( 'Table', [Scenario] = "A" ) )
        - CALCULATE ( SUM ( 'Table'[Metric] ), FILTER ( 'Table', [Scenario] = "B" ) )
)

Output:

vjianbolimsft_0-1675157328215.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Unfortunately, the user wants what I mentioned in the initial msg, 2 slicers with 2 tables. The intial solution you have provided was doing that, except that the column total for delta was not ok..

Hi @Anonymous ,

 

Sorry I misunderstood your needs before, please try this MEASURE:

Delta of selected scenarios in selected slicers = 
var _a = SUMMARIZE('Table','Table'[Function],"Metric",SUM('Table'[Metric]),"Metric2",CALCULATE(SUM('Table'[Metric]),FILTER(ALL('Table'),[Function]=EARLIER('Table'[Function])&&[Scenario] =SELECTEDVALUE('For slicer'[Scenario]))))
return 
SUMX(_a,[Metric]-[Metric2])

 Output:

vjianbolimsft_0-1675215459121.png

vjianbolimsft_1-1675215470602.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thank you very much, this is perfect!!

v-jianboli-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please try:

First create a new table for slcier:

vjianbolimsft_0-1675143996425.png

Then apply the measure:

Delta of selected scenarios in selected slicers =
SUM ( 'Table'[Metric] )
    - CALCULATE (
        SUM ( 'Table'[Metric] ),
        FILTER (
            ALL ( 'Table' ),
            [Function] = MAX ( 'Table'[Function] )
                && [Scenario] = SELECTEDVALUE ( 'For slicer'[Scenario] )
        )
    )

Create two slicers using 'Table'[Scenario] and 'For slicer'[Scenario] respectively

Final output:

vjianbolimsft_1-1675144153221.png

vjianbolimsft_2-1675144162853.png

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi, 

 

It's working, but the bottom totals are not doing delta. I mean, in your examples,  I should have - 40 and 0 on the bottom tables as grand totals.

 

Thank you!

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

May 2025 Monthly Update

Fabric Community Update - May 2025

Find out what's new and trending in the Fabric community.