Forum Discussion
Column Subtotals Errors
- 1 year ago
Hi Anonymous,
Thank you for reaching out to the Microsoft Fabric Forum Community.
Thanks for sharing the details and the screenshot it really helped clarify the issue you're encountering. You're trying to align your clustered bar chart and matrix visual by using the USG metric as a sorting reference. However, you're running into a problem where the 'Total' column in the matrix is either returning blank values or not displaying the USG values correctly. This is a common issue in Power BI that usually stems from how DAX measures evaluate in different context levels, especially in matrix total rows. Measures that work well on individual rows, like those using SELECTEDVALUE() or VALUES(), often return blanks at the total level because the row-level context doesn’t exist there.
modify your DAX formula so it handles both row-level and total-level evaluations appropriately. I suggest creating a new measure using a pattern like.
USG Total Fixed = IF( HASONEVALUE('YourTableName'[company_name]), [USG], // Replace this with your existing USG measure SUMX( VALUES('YourTableName'[company_name]), [USG] ) )This approach checks if a single company is being evaluated and, if so, simply returns the USG value. If it’s a total row, it aggregates USG across all visible companies using SUMX, ensuring a proper total is displayed. Once you've updated your measure, use it in the matrix visual's 'Total' column and apply sorting as needed.
If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.
Thank you.
well, the problem is that I don't know how to fix the DAX code to make it display properly ☹️
Hi Anonymous,
Thank you for reaching out to the Microsoft Fabric Forum Community.
Thanks for sharing the details and the screenshot it really helped clarify the issue you're encountering. You're trying to align your clustered bar chart and matrix visual by using the USG metric as a sorting reference. However, you're running into a problem where the 'Total' column in the matrix is either returning blank values or not displaying the USG values correctly. This is a common issue in Power BI that usually stems from how DAX measures evaluate in different context levels, especially in matrix total rows. Measures that work well on individual rows, like those using SELECTEDVALUE() or VALUES(), often return blanks at the total level because the row-level context doesn’t exist there.
modify your DAX formula so it handles both row-level and total-level evaluations appropriately. I suggest creating a new measure using a pattern like.
USG Total Fixed =
IF(
HASONEVALUE('YourTableName'[company_name]),
[USG], // Replace this with your existing USG measure
SUMX(
VALUES('YourTableName'[company_name]),
[USG]
)
)
This approach checks if a single company is being evaluated and, if so, simply returns the USG value. If it’s a total row, it aggregates USG across all visible companies using SUMX, ensuring a proper total is displayed. Once you've updated your measure, use it in the matrix visual's 'Total' column and apply sorting as needed.
If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.
Thank you.