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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Furio_P
Frequent Visitor

Measure Matrix incorrect total

Hello,

I setting up a matrix and populate it wi some measure calculation, like count, sum, percentage, etc. Rows are correct, but total is broken. How I fix it?

 

Furio_P_0-1714401719700.png

 

1 ACCEPTED SOLUTION

Hi @Furio_P ,

This solution is correct, more details can be found at this link:
Power BI Measure Total Is Incorrect: How To Fix It | Master Data Skills + AI (enterprisedna.co)

Bing Videos

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

5 REPLIES 5
Furio_P
Frequent Visitor

By the way, this formula performs well when applied to a single selected period (for instance, a month). However, when I set a quarter period (trimester) for two months, the total for the column appears incorrect:

 

Furio_P_0-1714719872825.png

 

Furio_P
Frequent Visitor

Thank you all; in the meantime, I have identified the solution by reading, indeed, various other posts with similar cases. Essentially, I have modified the formulas affected by this issue by adding a 'sumx' at the beginning of the formula for the type of values (categories) in the initial column of the matrix. This way, the totals are correct. For example, the column.

For example, the column "SLA Malus" has seen its formula for measurement modified as follows:

 

SLA Penale AGV L25 =
SUMX(
    VALUES('Siti Attività'[Sito Area]),
IF(
    [SLA AGV L25] <= 0.92,
    IF(
        (0.92 - [SLA AGV L25]) * [Costo Lotto L25 AGV] < 0,
        [Costo Lotto L25 AGV],
        (0.92 - [SLA AGV L25]) * [Costo Lotto L25 AGV]
    ))

)

 

The bold orange section is the added formula segment in the measurement to obtain a correct result.

Thank you very much for all your guidance; if you have any specific suggestions for this type of solution or not, please let me know. I wouldn't want to have found a solution that isn't actually one.

Hi @Furio_P ,

This solution is correct, more details can be found at this link:
Power BI Measure Total Is Incorrect: How To Fix It | Master Data Skills + AI (enterprisedna.co)

Bing Videos

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

 

v-kaiyue-msft
Community Support
Community Support

Hi @Furio_P ,

 

Your solution is great, @Greg_Deckler . I have another idea here, and I wanted to share it for reference.


Incorrect metrics in totals are a relatively common situation where the metrics follow the context of the ‘total’ row and are calculated within that context. As a result, a metric used in the columns of a table visualisation may have unexpected values in the ‘Total’ column.


You can use the following metrics to determine the data level using the IF() + ISINSCOPE() functions, and then perform different calculations depending on the level.

 

For example, in this measure 2, different results are shown for the date level and the total level. You can adjust the expression to suit your needs.

 

Measure 2 =
VAR _count = CALCULATE(DISTINCTCOUNT('Table'[Cod. User]),FILTER(ALL('Table'),'Table'[Date] = MAX('Table'[Date]))) //Counts the different user codes for the current date
VAR _table = SUMMARIZE('Table','Table'[Date],'Table'[Cod. User]) // Create virtual table to get table with unique date and user code values
VAR _total_count = COUNTROWS(_table) // Count the number of rows in the virtual table
RETURN
IF(ISINSCOPE('Table'[Date]),_count,_total_count) // Display different data in layers, date layer and total layer display different counts

vkaiyuemsft_0-1714444491575.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

 

Greg_Deckler
Super User
Super User

@Furio_P 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.