Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Column Subtotals Errors

Hi everyone,

 

I hope you can help me with this issue - thanks in advance! 

 

Context: You can see from the attached image below that I have:

Cluster Chart

  • x-axis: USG
  • y-axis:  company_name

Matrix

  • Row: company_name
  • Column: Metric
  • Value: Metric Value

 

Problem: The 'Column Subtotals' column is not displaying values correctly. I used a formula to pull values from the USG column, but only a few rows show values while others remain blank.

What I need: I need 'Column Subtotals' to correctly display values from the USG column so I can sort them in descending order to align with the cluster chart on the right.

 

Attempt: I have rewritten the DAX formula multiple times, but I haven’t been able to fix the issue 😫

 

Note: I attached the pbix + data file in the Reply section.

  • 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.

     

     

     

4 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      well, the problem is that I don't know how to fix the DAX code to make it display properly ☹️

      • v-saisrao-msft's avatar
        v-saisrao-msft
        Community Support

        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.