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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
darko861
Resolver II
Resolver II

Wrong Totals in Table and Matrix

Hi community,

 

I have the following pbix file:

 

https://www.dropbox.com/s/4o7jizvr07gwwb8/DataTest.pbix?dl=0

 

I have a column in the table and matrix called Revenue Display which summarizes the data to 47 136 which is wrong. Based on my condition I have also created a filter that displays the revenue if the GM is >=100 %. Both the table and matrix have selected the correct amounts but do not summarize to 198 244 which is the correct total amount for the column Revenue Display. Please note that totals for the month-year level are also incorrect for the matrix. 

 

How can I re-write my Dax so that it calculates the correct totals?

 

Thanks for your help!

 

darko861_3-1685030218096.png

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @darko861 ,

 

I suggest you to try this code to create a measure.

Revenue Display 2 = 
VAR _ADD =
    SUMMARIZE (
        Data,
        DimDate[Month-Year],
        Company[FTG],
        DimAccounts[Subheader],
        DimAccounts[Subheader2],
        "XXX", [Revenue_Filter]
    )
RETURN
    SUMX ( _ADD, [Revenue_Filter] )

vrzhoumsft_0-1685428170411.png

As the above screenshot, the duration of [Revenue Display 2] is only 355 ms, and the duration of [Revenue Display 3] is 11245 ms.

 

Best Regards,
Rico Zhou

 

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

7 REPLIES 7
Greg_Deckler
Community Champion
Community Champion

@darko861 First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler , Does not work, please check my sample file

I've got the table to work with this measure:

 

Revenue Display2 =

var MonthYear = SUMMARIZECOLUMNS(Company[FTG],DimDate[Month-Year],DimAccounts[Subheader],DimAccounts[Subheader2],"_Value",[Revenue_Filter])


RETURN

IF(HASONEVALUE(Company[FTG]),[Revenue_Filter],SUMX(MonthYear,[_Value]))
 
But the Matrix generates an error with the above measure, is there a better workaround?
 
 

The correct totals for the Matrix visual can be achieved by using this measure:

 

Revenue Display 3 = SUMX(ADDCOLUMNS(CROSSJOIN(VALUES(Company[FTG]),VALUES(DimDate[Month-Year]),VALUES(DimAccounts[Subheader]),VALUES(DimAccounts[Subheader2])),"XXX",[Revenue_Filter]),[Revenue_Filter])
 
But again, it doesn't seem optimal as it is slow when using a cross-join. Is there a better solution for both the table and matrix visual?
 
Your help is much appreciated.
 
Anonymous
Not applicable

Hi @darko861 ,

 

I suggest you to try this code to create a measure.

Revenue Display 2 = 
VAR _ADD =
    SUMMARIZE (
        Data,
        DimDate[Month-Year],
        Company[FTG],
        DimAccounts[Subheader],
        DimAccounts[Subheader2],
        "XXX", [Revenue_Filter]
    )
RETURN
    SUMX ( _ADD, [Revenue_Filter] )

vrzhoumsft_0-1685428170411.png

As the above screenshot, the duration of [Revenue Display 2] is only 355 ms, and the duration of [Revenue Display 3] is 11245 ms.

 

Best Regards,
Rico Zhou

 

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

 

@Anonymous , hi Rico, you summarized the whole Data table, if you dealing with large data sets, let's say the data table had millions of rows, would you still reference the whole Data table or just some columns from the data table in the Summerize measure? how would that measure look like if the data table had millions of rows?

 

Thanks!

Thanks, it is much quicker!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.