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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
JLambs20
Helper III
Helper III

Why won't matrix summarize correctly?

Hello! I'm going to show my full ignorance of DAX here so just keep that in mind when you see the code I wrote for this.  My issue is that the columns are displaying the correct values in this matrix, but the "Total" column only wants to show one of the values and isn't adding everything up.  I'm sure it's because of my DAX but I don't know the exact issue.  Here is the Matrix and the DAX:

JLambs20_1-1656365450191.png

 

Year 3 Cost =
SWITCH (
TRUE (),
MAX ( Density[Room Designation] ) = "Large",
CALCULATE (
SUMX ( Density, Density[# 7 Day Studies / Year3] * Density[Revenue / Study] ),
FILTER ( Density, Density[Value] = "DX" || Density[Value] = "MX" )
),
MAX ( Density[Room Designation] ) = "Small",
CALCULATE (
SUMX ( Density, Density[# 7 Day Studies / Year3] * Density[Revenue / Study] ),
FILTER ( Density, Density[Value] = "RX" )
),
BLANK ()
)
 
Thank you for the help!
2 REPLIES 2
Anonymous
Not applicable

Hi @JLambs20 ,

It seems that the total value of measure is not correct, right? This document has a detailed explanation.

Please refer to.

Dealing with Measure Totals 

 

Add an index column from 1 in Power Query.

Create  a measure.

VAR _b =
    SUMMARIZE ( 'Table', 'Table'[Index.1], "aaa", [Year 3 cost])
RETURN
    IF ( HASONEVALUE ( 'Table'[Index.1] ),[Year 3 cost] , SUMX ( _b, [aaa] ) )

 

 

There is also a post, please refer to it to see if it helps you.

How to remove duplicates count 

 

If I have misunderstood your meaning, please provide more details with your desired output and pbix file without privacy information (Or some sample data).

 

Best Regards

Community Support Team _ Polly

 

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

VahidDM
Super User
Super User

Hi @JLambs20 

 

 

Check this blog post, that might be useful and help you to sort out this issue:
https://www.vahiddm.com/post/why-my-measure-returns-the-wrong-total

 

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

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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