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

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.