Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Showing counts of different status (exists on different columns) as a hierarchical visual

Hi!

 

I am trying to show the counts of different statuys of the IDs in a hierarchical tree visual, but I am facing issues on the counts just adding up . Basically the data looks something like below:

IDStatus1Status2Status3Status4Status5Status6
1YYY   
2Y     
3YYYY  
4YYYYYY
5YY    
6YYYY  
7YYY   
8YYYYYY

 

What I want to show is  a tree with total unique count of IDs, dropped own to different status counts and that to be drilled down to each IDs.

 

If someone has done this and has ideas around it would be really appreciated.

 

Thanks

2 ACCEPTED SOLUTIONS
Greg_Deckler
Community Champion
Community Champion

So, generally you would unpivot all of those Status columns in Power Query and then things usually become trivial.

 

If that is not the case, Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

v-gizhi-msft
Community Support
Community Support

Hi,

 

Please take the following steps:

1)Unpivot all status columns.

2)Create a table by Enter data as below:

10.PNG

3)Try this measure:

Count_of_each_id = 
IF (
    ISINSCOPE ( 'Level'[Lev8] ),
    CALCULATE (
        COUNT ( 'Table'[Value] ),
        FILTER ( 'Table', 'Table'[ID] = 8 && 'Table'[Value] = "Y" )
    ),
    IF (
        ISINSCOPE ( 'Level'[Lev7] ),
        CALCULATE (
            COUNT ( 'Table'[Value] ),
            FILTER ( 'Table', 'Table'[ID] = 7 && 'Table'[Value] = "Y" )
        ),
        IF (
            ISINSCOPE ( 'Level'[Lev6] ),
            CALCULATE (
                COUNT ( 'Table'[Value] ),
                FILTER ( 'Table', 'Table'[ID] = 6 && 'Table'[Value] = "Y" )
            ),
            IF (
                ISINSCOPE ( 'Level'[Lev5] ),
                CALCULATE (
                    COUNT ( 'Table'[Value] ),
                    FILTER ( 'Table', 'Table'[ID] = 5 && 'Table'[Value] = "Y" )
                ),
                IF (
                    ISINSCOPE ( 'Level'[Lev4] ),
                    CALCULATE (
                        COUNT ( 'Table'[Value] ),
                        FILTER ( 'Table', 'Table'[ID] = 4 && 'Table'[Value] = "Y" )
                    ),
                    IF (
                        ISINSCOPE ( 'Level'[Lev3] ),
                        CALCULATE (
                            COUNT ( 'Table'[Value] ),
                            FILTER ( 'Table', 'Table'[ID] = 3 && 'Table'[Value] = "Y" )
                        ),
                        IF (
                            ISINSCOPE ( 'Level'[Lev2] ),
                            CALCULATE (
                                COUNT ( 'Table'[Value] ),
                                FILTER ( 'Table', 'Table'[ID] = 2 && 'Table'[Value] = "Y" )
                            ),
                            IF (
                                ISINSCOPE ( 'Level'[Lev1] ),
                                CALCULATE (
                                    COUNT ( 'Table'[Value] ),
                                    FILTER ( 'Table', 'Table'[ID] = 1 && 'Table'[Value] = "Y" )
                                ),
                                CALCULATE ( COUNT ( 'Table'[Value] ), FILTER ( 'Table', 'Table'[Value] = "Y" ) )
                            )
                        )
                    )
                )
            )
        )
    )
)

4)The result shows:

11.PNG

Here is my test pbix file:

pbix 

Hope this helps.

 

Best Regards,

Giotto

View solution in original post

2 REPLIES 2
v-gizhi-msft
Community Support
Community Support

Hi,

 

Please take the following steps:

1)Unpivot all status columns.

2)Create a table by Enter data as below:

10.PNG

3)Try this measure:

Count_of_each_id = 
IF (
    ISINSCOPE ( 'Level'[Lev8] ),
    CALCULATE (
        COUNT ( 'Table'[Value] ),
        FILTER ( 'Table', 'Table'[ID] = 8 && 'Table'[Value] = "Y" )
    ),
    IF (
        ISINSCOPE ( 'Level'[Lev7] ),
        CALCULATE (
            COUNT ( 'Table'[Value] ),
            FILTER ( 'Table', 'Table'[ID] = 7 && 'Table'[Value] = "Y" )
        ),
        IF (
            ISINSCOPE ( 'Level'[Lev6] ),
            CALCULATE (
                COUNT ( 'Table'[Value] ),
                FILTER ( 'Table', 'Table'[ID] = 6 && 'Table'[Value] = "Y" )
            ),
            IF (
                ISINSCOPE ( 'Level'[Lev5] ),
                CALCULATE (
                    COUNT ( 'Table'[Value] ),
                    FILTER ( 'Table', 'Table'[ID] = 5 && 'Table'[Value] = "Y" )
                ),
                IF (
                    ISINSCOPE ( 'Level'[Lev4] ),
                    CALCULATE (
                        COUNT ( 'Table'[Value] ),
                        FILTER ( 'Table', 'Table'[ID] = 4 && 'Table'[Value] = "Y" )
                    ),
                    IF (
                        ISINSCOPE ( 'Level'[Lev3] ),
                        CALCULATE (
                            COUNT ( 'Table'[Value] ),
                            FILTER ( 'Table', 'Table'[ID] = 3 && 'Table'[Value] = "Y" )
                        ),
                        IF (
                            ISINSCOPE ( 'Level'[Lev2] ),
                            CALCULATE (
                                COUNT ( 'Table'[Value] ),
                                FILTER ( 'Table', 'Table'[ID] = 2 && 'Table'[Value] = "Y" )
                            ),
                            IF (
                                ISINSCOPE ( 'Level'[Lev1] ),
                                CALCULATE (
                                    COUNT ( 'Table'[Value] ),
                                    FILTER ( 'Table', 'Table'[ID] = 1 && 'Table'[Value] = "Y" )
                                ),
                                CALCULATE ( COUNT ( 'Table'[Value] ), FILTER ( 'Table', 'Table'[Value] = "Y" ) )
                            )
                        )
                    )
                )
            )
        )
    )
)

4)The result shows:

11.PNG

Here is my test pbix file:

pbix 

Hope this helps.

 

Best Regards,

Giotto

Greg_Deckler
Community Champion
Community Champion

So, generally you would unpivot all of those Status columns in Power Query and then things usually become trivial.

 

If that is not the case, Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.