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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Measure does not show correct variance when pivot table filter context does not contain any value

Hello,

 

What I want to do:

Sort column C by the "difference from", "Scen2" column shown below in descending order. 

zestycat_1-1658713211286.png

 

What I tried doing already:

1. Create a "Difference From" column from "Value Field Setting" and sort --> did not work

2. Create a measure to simulate "Difference From" through Power Query --> sorting seems to work but the columns are mixed as highlighted in yellow above.

 

DAX Formula:

 

 

 

=VAR sum_scen1 = CALCULATE(SUM(Table1[annual]), Table1[A]="Scen1")
VAR sum_scen2 = CALCULATE(SUM(Table1[annual]), Table1[A]="Scen2")
RETURN sum_scen2-sum_scen1

 

 

 

 

I wish there is a place to attach the file but here it is!

Thank you!

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Please show grand totals in Excel. Does this match your desired output?

 

vkkfmsft_1-1658911550925.png

vkkfmsft_0-1658911404794.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
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

5 REPLIES 5
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please try the measure and change the subtotal label.

 

Measure = 
VAR sum_scen1 =
    CALCULATE ( SUM ( Table1[annual] ), Table1[A] = "Scen1" )
VAR sum_scen2 =
    CALCULATE ( SUM ( Table1[annual] ), Table1[A] = "Scen2" )
RETURN
    IF ( ISFILTERED ( Table1[A] ), SUM ( Table1[annual] ), sum_scen2 - sum_scen1 )

vkkfmsft_0-1658889317914.png

vkkfmsft_1-1658889330941.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
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 for your reply!

However, this solution does not seem to work in Excel Power Query/Power Pivot.

Would you please take a look at this again?

Thanks!

 

zestycat_0-1658894751291.png

 

Hi @Anonymous ,

 

Please show grand totals in Excel. Does this match your desired output?

 

vkkfmsft_1-1658911550925.png

vkkfmsft_0-1658911404794.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
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 Ibendlin! This link should now work.

lbendlin
Super User
Super User

The link yields a 401

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Solution Authors
Top Kudoed Authors