Forum Discussion
Measure Matrix incorrect total
- Anonymous2 years ago
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)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.
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
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.