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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
wpf_
Post Prodigy
Post Prodigy

Why aren't my Matrix totals not correct?

I have a matrix that have have dates in rows, locations in columns, and current months sum for each location, previous years of the exact month sum, and percentage change between the two as the values.  However the total of each row is not correct.  In the image below, i omitted the different column locations.  The values of each column are accurate as i crossed referenced with the real data, but the total for current, prev (in red) are not when I add them up manually.  Is there any setting that is causing this? Thanks.

 

wpf__0-1593730847317.png

 

4 REPLIES 4
amitchandak
Super User
Super User

@wpf_ , if you formula/measure use row context to get the calculation then Grand total also need that,try like this

sumx(Summarize(Table, Table[Year], Table[Month], Table[?], "_1",[Measure]),[_1])

 

Where Table[?] is column group by

and Measure is your current measure

Hi @amitchandak ,

 

Thanks for your reply.  I kind of understand why my totals aren't correct.  Can you please see my reply above.  This is a head scratcher.  Kind of like the chicken or the egg scenario. Thanks. 

AllisonKennedy
Super User
Super User

What is the formula you're using for the three measures? See if this post helps:
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Hi @AllisonKennedy ,

 

Thanks for your reply.  I tried the suggestion that you refered me to but it didnt work.  But I kind of know why it is doing it now.  To better explain it here is my table again with the locations 21 - 30 (each representing a location).  

 

wpf__0-1593793939693.png

Just focusing on the 'current' measure.  Location 30 needs to have its value multipled by 2.1, and all other locations are just sumed up regularly. The values are taken by two methods: method1 and method2. 

 

Current = IF(SELECTEDVALUE('Table'[Location])=30,
SUMX('Table', ('Table'[Method1]+'Table'[Method2])*2.1),
SUMX('Table', 'Table'[Method1] + 'Table'[Method2])
)
 
So the problem is when the Total Current is summed, it is getting the current from all locations and that includes location 30.  And it does not use the calculated Current of Location 30, becaue of the nature of the condition.  
 
I am trying to find logic to take in the Current of 30, but if I do that, the Current of the other locations would use that as well in their values.  Is there any way to reference the Total column so I can include that in the IF statement.  Or do you have a better alternative from what I am doing?  Thanks. 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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