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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
ganesanr1002
Frequent Visitor

sum of Variance Getting wrong ,anyone help to sort it out

Hi Guys , 

Here i trying to find the variance each of the line items it is matching exactly but the total of that it is not matching at all ,Can anybody help me to sort it out . 

I have AOP, City, Item, COGS , Dim Date Tables , 

Here I'm Trying to get the variance for the COGS between Actual and AOP based on the City ,Item and Month and Year.

ganesanr1002_1-1688838212853.png

Table Structure 

AOP 

ganesanr1002_2-1688838335301.png

City 

ganesanr1002_3-1688838359169.png

 

COGS 

ganesanr1002_5-1688838379779.png

 Dim Date

ganesanr1002_6-1688838403790.png

 

Item 

ganesanr1002_7-1688838415034.png

 

Relationship 

ganesanr1002_8-1688838448418.png

 

Measure Used for 

Avg AOP Price = AVERAGE(AOP[Value])
Actual Price = SUM(COGS[Total])/SUM(COGS[Quantity])
Variance = [Avg AOP Price]-[Actual Price]
 
Can anybody Help me sort it out , Thanks in Advance

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

@ganesanr1002 
Seems that in the table visual, you have placed the date column from the AOP table this is why you have wrong values for the Actual Price (which apparently you did not notice). You need to use the date column only from the date table as it filters both fact tables.

1.png

Variance = 
SUMX (
    CROSSJOIN (
        CROSSJOIN ( VALUES ( 'Item'[Item Name] ), VALUES ( City[City] ) ),
        VALUES ( 'Dim Date'[Date] )
    ),
    [Avg AOP Price] - [Actual Price]
)

View solution in original post

4 REPLIES 4
tamerj1
Super User
Super User

Hi @ganesanr1002 

please try

Variance =
SUMX (
CROSSJOIN (
CROSSJOIN ( VALUES ( Item[Item Nsme] ), VALUES ( City[City] ) ),
VALUES ( 'Dim Date'[Date] )
),
[Avg AOP Price] - [Actual Price]
)

Hi @tamerj1  , 

Now total it is matching but as per the row not matching 

ganesanr1002_0-1688849118073.png

 

@ganesanr1002 
Seems that in the table visual, you have placed the date column from the AOP table this is why you have wrong values for the Actual Price (which apparently you did not notice). You need to use the date column only from the date table as it filters both fact tables.

1.png

Variance = 
SUMX (
    CROSSJOIN (
        CROSSJOIN ( VALUES ( 'Item'[Item Name] ), VALUES ( City[City] ) ),
        VALUES ( 'Dim Date'[Date] )
    ),
    [Avg AOP Price] - [Actual Price]
)

@tamerj1  thanks i forgot to check date column , It works , Thanks for the solution .

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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