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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
justlearning50
Frequent Visitor

How to eliminate 'blank' bars in a chart using drilldown and variable hierarchy path length

Hi I'm using 2 tables - one with data, and one with the hierarchy (teams). When I drilldown I always have a 'Blank' column. I know I can filter out the blanks using the filter panel, but that removes a team from the previous level where that was the lowest level in that particular hierarchy.

eg below with blanks selected in the Level 3 filter

At level 2 I get all 4 groups

justlearning50_1-1718267733035.png

 

And at Level 3 I have a 'blank' column which I don't want.

justlearning50_0-1718267549875.png

 

If I filter out the blanks in the Level 3 filter, I get this at level 2 - first group is missing as it was the lowest level in its hierarchy path.

justlearning50_2-1718267885916.png

 

I understand why this is happening, just not sure what to do about it. I've watched a number of videos, but I'm not sure how to use the information in this case (generally ISINSCOPE), as I'm using two tables, and they generally are looking at a matrix and using one table. 

 

I hope this makes sense. Thanks in advance for your help.

 

 

2 ACCEPTED SOLUTIONS
rajendraongole1
Super User
Super User

Hi @justlearning50 - we'll use ISINSCOPE to determine which level of the hierarchy we are currently in and handle 'Blanks'

I have taken example with sales amount replace with your table and fields as per your reference.

Create a below DAX measure:

create displaysales to avoid blanks.

 

DisplaySales =
IF(
ISBLANK(SUM(DataTable[Sales])),
BLANK(),
SUM(DataTable[Sales])
)

 

use the above Displaysales measure in your conditional measure with hierarchy .

 

ConditionalDisplay =
IF(
ISINSCOPE(HierarchyTable[Level3]),
[DisplaySales], // Only show non-blank sales at Level 3
IF(
ISINSCOPE(HierarchyTable[Level2]),
IF(
NOT(ISBLANK([DisplaySales])),
[DisplaySales],
BLANK()
),
IF(
ISINSCOPE(HierarchyTable[Level1]),
[SalesAmount],
BLANK()
)
)
)

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

justlearning50
Frequent Visitor

Hi @rajendraongole1 , this didn't quite work for me, maybe because I had more levels than I showed) but it helped me on the way, so thank you.

 

What did work in the end was this

measure 1

HideCompliance = IF
    (
         [LevelScope] <= min(table_name[Path Length]) ,1
    )
// Pathlength is a calculated column : Path Length = PATHLENGTH(table_name[Hierarchy path])
 
I used a SWITCH() function to assign mumbers to my levels
LevelScope =
SWITCH (
    TRUE (),
    ISINSCOPE ( table_name[Level6] ), 6,
    ISINSCOPE ( table_name[Level5] ), 5,
    ISINSCOPE ( table_name[Level4] ), 4,
    ISINSCOPE (table_name[Level3]), 3,
    ISINSCOPE ( table_name[Level2] ), 2,
    ISINSCOPE ( table_name[Top Level]), 1
)
 
Then I just used the variable * [HideVisual] and plotted that. 
 
Averagecompliance = CALCULATE
    (
        AVERAGE
            (
                Table column
            )
            * [HideCompliance]
    )
 
It may not be perfect DAX, but it worked from what I can see. 
Hope this helps someone else.

View solution in original post

2 REPLIES 2
justlearning50
Frequent Visitor

Hi @rajendraongole1 , this didn't quite work for me, maybe because I had more levels than I showed) but it helped me on the way, so thank you.

 

What did work in the end was this

measure 1

HideCompliance = IF
    (
         [LevelScope] <= min(table_name[Path Length]) ,1
    )
// Pathlength is a calculated column : Path Length = PATHLENGTH(table_name[Hierarchy path])
 
I used a SWITCH() function to assign mumbers to my levels
LevelScope =
SWITCH (
    TRUE (),
    ISINSCOPE ( table_name[Level6] ), 6,
    ISINSCOPE ( table_name[Level5] ), 5,
    ISINSCOPE ( table_name[Level4] ), 4,
    ISINSCOPE (table_name[Level3]), 3,
    ISINSCOPE ( table_name[Level2] ), 2,
    ISINSCOPE ( table_name[Top Level]), 1
)
 
Then I just used the variable * [HideVisual] and plotted that. 
 
Averagecompliance = CALCULATE
    (
        AVERAGE
            (
                Table column
            )
            * [HideCompliance]
    )
 
It may not be perfect DAX, but it worked from what I can see. 
Hope this helps someone else.
rajendraongole1
Super User
Super User

Hi @justlearning50 - we'll use ISINSCOPE to determine which level of the hierarchy we are currently in and handle 'Blanks'

I have taken example with sales amount replace with your table and fields as per your reference.

Create a below DAX measure:

create displaysales to avoid blanks.

 

DisplaySales =
IF(
ISBLANK(SUM(DataTable[Sales])),
BLANK(),
SUM(DataTable[Sales])
)

 

use the above Displaysales measure in your conditional measure with hierarchy .

 

ConditionalDisplay =
IF(
ISINSCOPE(HierarchyTable[Level3]),
[DisplaySales], // Only show non-blank sales at Level 3
IF(
ISINSCOPE(HierarchyTable[Level2]),
IF(
NOT(ISBLANK([DisplaySales])),
[DisplaySales],
BLANK()
),
IF(
ISINSCOPE(HierarchyTable[Level1]),
[SalesAmount],
BLANK()
)
)
)

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.