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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors