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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
sparkplug93751
Helper II
Helper II

Hierarchy inside Measure

Hello,

 

See attached example data

 

My data has a planned number of people (planned column) per category

 

There's 2 categories - the master column and legend where each legend fall beneath a master to establish a hierarchy ie 1 has 11, 12, and 13

 

All have hardkeyed plans. The masters have their own independent from a legend value.

 

How can I have a measure that switch between the correct master then legend after filtering ie If i have a master filter and select 2, 98 appears then if i filter again to 22, 95 appears.

 

https://tuprd-my.sharepoint.com/:x:/g/personal/tug67925_temple_edu/EXwVQvIKn_RDv1m9H3xbX8wBsCLJdcCbt...

1 ACCEPTED SOLUTION

Hi,

 

Do you want to show this measure in matrix visual?

If so, please try this measure:

Measure = 
IF (
    CALCULATE ( DISTINCTCOUNT ( 'Table'[Inside] ), ALLSELECTED ( 'Table' ) )
        <> CALCULATE ( DISTINCTCOUNT ( 'Table'[Inside] ), ALL ( 'Table' ) ),
    IF (
        ISINSCOPE ( 'Table'[Inside] ),
        BLANK (),
        CALCULATE (
            MAXX ( ALLSELECTED ( 'Table' ), 'Table'[Plan] ),
            FILTER ( 'Table', 'Table'[Master] = SELECTEDVALUE ( 'Table'[Master] ) )
        )
    ),
    CALCULATE (
        MAX ( 'Table'[Plan] ),
        FILTER (
            'Table',
            'Table'[Master] = SELECTEDVALUE ( 'Table'[Master] )
                && 'Table'[Inside] = SELECTEDVALUE ( 'Table'[Inside] )
        )
    )
)

When only selecting master in slicer, it shows:

50.PNG

When both selecting master and inside in slicers, it shows:

51.PNG

Here is my changed pbix file:

pbix 

 

Best Regards,

Giotto Zhi

 

View solution in original post

6 REPLIES 6
v-gizhi-msft
Community Support
Community Support

Hi,

 

Please try this measure:

Measure = 
IF (
    SELECTEDVALUE ( 'Table'[Inside] ) = BLANK (),
    CALCULATE (
        MAXX ( ALLSELECTED ( 'Table' ), 'Table'[Plan] ),
        FILTER ( 'Table', 'Table'[Master] = SELECTEDVALUE ( 'Table'[Master] ) )
    ),
    CALCULATE (
        MAX ( 'Table'[Plan] ),
        FILTER (
            'Table',
            'Table'[Master] = SELECTEDVALUE ( 'Table'[Master] )
                && 'Table'[Inside] = SELECTEDVALUE ( 'Table'[Inside] )
        )
    )
)

Choose this measure as a Card visual, when you only select master in slicer, it shows:

20.PNG

When you continue to select Inside in slicer, it shows:

21.PNG

Here is my test pbix file:

pbix 

Hope this helps.

 

Best Regards,

Giotto Zhi

 

Can this be applied to a measure rather than a card?

Hi,

 

Do you want to show this measure in matrix visual?

If so, please try this measure:

Measure = 
IF (
    CALCULATE ( DISTINCTCOUNT ( 'Table'[Inside] ), ALLSELECTED ( 'Table' ) )
        <> CALCULATE ( DISTINCTCOUNT ( 'Table'[Inside] ), ALL ( 'Table' ) ),
    IF (
        ISINSCOPE ( 'Table'[Inside] ),
        BLANK (),
        CALCULATE (
            MAXX ( ALLSELECTED ( 'Table' ), 'Table'[Plan] ),
            FILTER ( 'Table', 'Table'[Master] = SELECTEDVALUE ( 'Table'[Master] ) )
        )
    ),
    CALCULATE (
        MAX ( 'Table'[Plan] ),
        FILTER (
            'Table',
            'Table'[Master] = SELECTEDVALUE ( 'Table'[Master] )
                && 'Table'[Inside] = SELECTEDVALUE ( 'Table'[Inside] )
        )
    )
)

When only selecting master in slicer, it shows:

50.PNG

When both selecting master and inside in slicers, it shows:

51.PNG

Here is my changed pbix file:

pbix 

 

Best Regards,

Giotto Zhi

 

amitchandak
Super User
Super User

Did not get it completely

https://community.powerbi.com/t5/Desktop/Hierarchy-of-calculated-measures/td-p/117433

https://visualbi.com/blogs/microsoft/powerbi/customizing-hierarchy-measures-dax-using-inscope/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

The values are displaying correctly when inside a matrix but not when plotted on a line graph

I'm only getting blank values using isinscope

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors