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
Anonymous
Not applicable

How to change the data model to accommodate the below requirement?

Hi,

I have a requirement where I have display the values in the matrix visual.

The data is like this:

karthikbv4_0-1599229846817.png

The "null" value in the level2 and level3 indicate that the score is for that particular Level1.

for eg: In line 1, the values for level2 and level3 is null ,which indicates that the score1 and score 2 for Level 1 are 3.5 and 3.5 respectively.

There are a total of 3 levels. They should be displayed in hierarchy, like:

Level 1 

            Level 2

                        Level 3.

For eg: 2 level hierarchy, it goes like:

Level 2             score1           score2

A                      3.5                 3,5

   AA                 3                    3

   AB                 4                    3

   AC                4                     3

B                      3.2                 3.2

   BA                 3                    4

   BB                 4                    3

 

What changes should I make to the datamodel/column to accomodate this?

Any help is appreciated. Thanks.

 

 

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

You can create this measure:

s1 = 
IF (
    ISINSCOPE ( Test[Level 2] ),
    IF ( SELECTEDVALUE ( Test[Level 2] ) <> "", SUM ( Test[score 1] ) ),
    IF (
        ISINSCOPE ( Test[Level 1] ),
        CALCULATE (
            SUM ( Test[score 1] ),
            FILTER (
                ALL ( 'Test' ),
                Test[Level 1] = SELECTEDVALUE ( Test[Level 1] )
                    && Test[Level 2] = ""
            )
        )
    )
)

Measure s2 is similar with s1:

level.png

Attached a sample file in the below, hopes to help you.

 

Best Regards,
Yingjie Li

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

View solution in original post

5 REPLIES 5
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

You can create this measure:

s1 = 
IF (
    ISINSCOPE ( Test[Level 2] ),
    IF ( SELECTEDVALUE ( Test[Level 2] ) <> "", SUM ( Test[score 1] ) ),
    IF (
        ISINSCOPE ( Test[Level 1] ),
        CALCULATE (
            SUM ( Test[score 1] ),
            FILTER (
                ALL ( 'Test' ),
                Test[Level 1] = SELECTEDVALUE ( Test[Level 1] )
                    && Test[Level 2] = ""
            )
        )
    )
)

Measure s2 is similar with s1:

level.png

Attached a sample file in the below, hopes to help you.

 

Best Regards,
Yingjie Li

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

Greg_Deckler
Community Champion
Community Champion

@Anonymous - I am pretty certain that you will want to unpivot your Level columns.



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...
Anonymous
Not applicable

Okay. How do you propose I unpivot that?

amitchandak
Super User
Super User

@Anonymous , see if this can help in display

https://www.kasperonbi.com/use-isinscope-to-get-the-right-hierarchy-level-in-dax/

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
Anonymous
Not applicable

Thank you.

But, it does not work in my case.

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
Top Kudoed Authors