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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Sander1401
Helper II
Helper II

Totals doesn't match with matrix rows

Hi All,

 

I have a problem and I need your help. I am working on a calculations of PxQ (price x quantity). On rowlevel it works, but on total level it doesn't add up. The totals are much higher than the sum of the rows.
The calculation is as below:

Q avg last 2 months gives the average of the number of products of the last months (Finance wants it that way).

Q avg last 2 months =
VAR CurrentMonth =
    SELECTEDVALUE ( data[Date] )

RETURN
AVERAGEX (
    TOPN (
        2,                                            
        FILTER (
            ALL ( data[Date]),
           data[Date] <= CurrentMonth              
        ),
        data[Date], DESC
    ),
    CALCULATE ( SUM (data[Q] ) )                
)

P is the price.

PxQ = [Q avg last 2 months] * AVERAGE(data[P])



Can anyone help me out, so the totals match up with the sum of the rows, please?
For example: In the matrix the column on the right says 305.846,76, but the rows only sums up to 223.425,55

 

please find attached the link to my test dashboard:

https://www.dropbox.com/scl/fi/vfymixfzng0vllckiunl3/test_PxQ.pbix?rlkey=o852p2xqpht0e1hr2odywyl4p&s...

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Drag this measure to the visual

Measure = SUMX(VALUES(data[productid]),[PxQ])
Hope this helps.
Ashish_Mathur_0-1770251341015.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

Drag this measure to the visual

Measure = SUMX(VALUES(data[productid]),[PxQ])
Hope this helps.
Ashish_Mathur_0-1770251341015.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

You are a lifesaver! Thank you very much!

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
m4ni
Resolver I
Resolver I

Maybe filter you matrix and measure to the same rows to understand...

 

m4ni
Resolver I
Resolver I

@Sander1401 , this is not uncommon in Power BI.  Usually requires investigation at a more granular level.  Its difficult to respond with exact solution but I would suggest if you can look at a specific row or ID example to try and understand what the measures / totals are doing.  It may become evident like this.  HTH

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

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.