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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Variance Calculation Error (Summarize)

Hi All,

 

This sould be an easy fix but I am having an issue with the total variance calculation I am trying to do for price. Essentially the user has two tables to select the current period vs the previous period and then I am running a Price Variation calculation off of it:

 

(Average Current Price - Average Previous Price) * Current Volume

 

I want this action done at the item level however the total is off. Below is my equation and a picture of the results. Any idea what I am doing wrong in the calc? It looks like its working at the row level but then is off when I do the total.

 

Measure =
VAR AvgCurPrice = SUMX(
SUMMARIZE('Current Variance','Current Variance'[item],
"Cur Avg Price",[Current Avg Price]),[Cur Avg Price])
VAR AvgPrevPrice = SUMX(
SUMMARIZE('Previous Variance','Previous Variance'[item],
"Prev Avg Price",[PAvg Price]),[Prev Avg Price])
VAR CurVol = SUMX(
SUMMARIZE('Current Variance','Current Variance'[item],
"Cur Avg Vol",[Current Vol]),[Cur Avg Vol])

RETURN SUMX(
SUMMARIZE('Current Variance','Current Variance'[item],
"Variance",(AvgCurPrice-AvgPrevPrice)*CurVol),[Variance])
 
Longhorn2009_0-1621094477996.png

 

2 REPLIES 2
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

Based on your explanation, I create a sample file and try to reproduce your problem. Unfortunately, it goes wrong. 

So can you share more details, or PBI sample file after removing sensitive information better?

v-xiaotang_0-1621335613585.png

Besides, what’s the result you want? Can you mark the result you want on the picture? Because I have little understanding of your words  that I want this action done at the item level”.

 

Best Regards,

Community Support Team _ Tang

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

daxer-almighty
Solution Sage
Solution Sage

You have to describe what you want the total to be first. If you want the calculation to be done item by item and then the results for all visible items somehow aggregated, then you have to do just that. Your current formula does not do it. On top of that, variables once calculated do not change their values and they are immune to context. Variables do not behave like measures.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.