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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Pedro_R
New Member

Participation inside a Hierarchy

I have a dataset with a hierarchy and value, something like this:

 

Level 1Level 2Level 3Value
acategory 1class 1300
acategory 1class 2200
acategory 2class 1500

 

I need to know how I could see the % respected each level inside a Descomposition Tree or Matrix to display it in the same column.

For example if I select only level 1 and level 3 I have to display 80% for class 1, but if I select the levels 1 and 2 I have to see 50% in category 1.

 

How I could get it?

1 ACCEPTED SOLUTION
v-deddai1-msft
Community Support
Community Support

Hi,

 

You can use ISINSCOPE function to calculate it:

 

Measure =

VAR A =

    CALCULATE ( SUM ( 'Table'[Value] ), ALL ( 'Table' ) )

RETURN

    IF (

        ISINSCOPE ( 'Table'[Level 2] ),

        IF (

            ISINSCOPE ( 'Table'[Level 3] ),

            SUM ( 'Table'[Value] ) / A,

            CALCULATE (

                SUM ( 'Table'[Value] ),

                FILTER ( 'Table', 'Table'[Level 2] IN DISTINCT ( 'Table'[Level 2] ) )

            ) / A

        ),

        CALCULATE (

            SUM ( 'Table'[Value] ),

            FILTER ( 'Table', 'Table'[Level 1] IN DISTINCT ( 'Table'[Level 1] ) )

        ) / A

    )

 

Untitled picture1.png

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

 

Best Regards,

Dedmon Dai

View solution in original post

2 REPLIES 2
v-deddai1-msft
Community Support
Community Support

Hi,

 

You can use ISINSCOPE function to calculate it:

 

Measure =

VAR A =

    CALCULATE ( SUM ( 'Table'[Value] ), ALL ( 'Table' ) )

RETURN

    IF (

        ISINSCOPE ( 'Table'[Level 2] ),

        IF (

            ISINSCOPE ( 'Table'[Level 3] ),

            SUM ( 'Table'[Value] ) / A,

            CALCULATE (

                SUM ( 'Table'[Value] ),

                FILTER ( 'Table', 'Table'[Level 2] IN DISTINCT ( 'Table'[Level 2] ) )

            ) / A

        ),

        CALCULATE (

            SUM ( 'Table'[Value] ),

            FILTER ( 'Table', 'Table'[Level 1] IN DISTINCT ( 'Table'[Level 1] ) )

        ) / A

    )

 

Untitled picture1.png

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

 

Best Regards,

Dedmon Dai

amitchandak
Super User
Super User

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.