Forum Discussion

dc52's avatar
dc52
Frequent Visitor
2 years ago
Solved

Hierarchy Not displaying subtotal correctly

Hello,

I am working on a matrix visual for college programs where I am hoping to divide up students by a hierarchy of Schools and Majors but the subtotals for Schools is displaying incorrectly. Any ideas what it may be?

 

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi dc52 ,

    You can modify your measure like the example below (other measures also modify like the example, you can refer to the attachement of pbix file):

    Events Count by Major_ = 
    VAR _school = SELECTEDVALUE(Students[School])
    RETURN
    CALCULATE(
        DISTINCTCOUNT('Events'[ID Name]),
        FILTER('Students','Students'[School]=_school))

    And then add a new measure, put the new measure into Matrix:

    Events Count by Major =
    SUMX(VALUES(Students[School]), [Events Count by Major_])

    Final output:

    Best Regards,

    Ada Wang

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

7 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi dc52 ,

    Check that the way measure aggregates the data is consistent with the hierarchy.
    By the way, mention if there are levels in your hierarchy that have no data. For more information, see:
    Create a matrix visual in Power BI - Power BI | Microsoft Learn

     

    How to Get Your Question Answered Quickly - Microsoft Fabric Community

    If it does not help, please provide more details with your desired out put and pbix file without privacy information.

     

    Best Regards,

    Ada Wang

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

    • dc52's avatar
      dc52
      Frequent Visitor

      Thanks for the response!
      So do subtotals for hierarchies not add themselves up automatically? Is it something I need to create a new measure for and then add to the visual?