Forum Discussion
Percentage Subtotals on Matrix Incorrect
- 5 years ago
Anonymous 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
Thanks! That pointed me in the right direction. I needed 2 HASONEFILTER functions to get both the columns and row subtotals correct.
HoursAvailable = IF(HASONEFILTER('Capacity Planner'[ResourceName]),IF(HASONEFILTER('Capacity Planner'[EndOfMonth]),
MAX(DateTable[WorkingHoursAvailable]) - [HoursFiltered],
DISTINCTCOUNT('Capacity Planner'[EndOfMonth]) * MAX(DateTable[WorkingHoursAvailable]) - [HoursFiltered]),
DISTINCTCOUNT('Capacity Planner'[ResourceName]) * MAX(DateTable[WorkingHoursAvailable]) - [HoursFiltered])Hoursfiltered is a new measure that contains the sumx from above to help with readability. Any idea how I would get the grand total corect? I probably just need to reorder the ifs, but my logic brain isn't getting it at the moment:
I needed to multiply the two distinct count columns together on both hasonefilters to get the correct values. It took way too long to get to that logic in my brain, but it makes sense because when there's subtotals, it's multiplying by 1 and for the grand total, it's the total number of cells in the matrix.