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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Handling Stepped Matrix and Displaying values based on Current Stepped Row Level

Hello!

I am currently trying to build a matrix visual that would incorporate Hierarchy with a functionality of choosing displayed value based on currently Expanded Row (Expanding/Collapsing changes the calculated column from which we take the value):

So, for example:

ArturDylan_1-1607093279297.png

 


So basically I'm looking for a way to create a measure, that verifies on which ROWS level I am:

ArturDylan_3-1607093310109.png

And then takes correct calculated column (PRJ/PGM/INI).

Do you think thats possible?

Attaching demo values (can't upload .pbix somehow).

ArturDylan_4-1607093636498.png

and visual:

ArturDylan_5-1607093646235.png

 

 



 



1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

You can create two measures as below, please find the details in the attachment:

RAG = 
VAR _iniselected =
    ISINSCOPE ( 'Table'[Initiative] )
VAR _proselected =
    ISINSCOPE ( 'Table'[Program] )
VAR _inirag =
    CALCULATE (
        MAX ( 'Table'[INI.RAG] ),
        ALLEXCEPT ( 'Table', 'Table'[Initiative] )
    )
VAR _prorag =
    CALCULATE (
        MAX ( 'Table'[PGM.RAG] ),
        ALLEXCEPT ( 'Table', 'Table'[Program] )
    )
RETURN
    SWITCH ( TRUE (), _proselected, _prorag, _iniselected, _inirag )
Status = 
VAR _iniselected =
    ISINSCOPE ( 'Table'[Initiative] )
VAR _proselected =
    ISINSCOPE ( 'Table'[Program] )
VAR _inistatus =
    CALCULATE (
        MAX ( 'Table'[INI.Status] ),
        ALLEXCEPT ( 'Table', 'Table'[Initiative] )
    )
VAR _prostatus =
    CALCULATE (
        MAX ( 'Table'[PGM.Status] ),
        ALLEXCEPT ( 'Table', 'Table'[Program] )
    )
RETURN
    SWITCH ( TRUE (), _proselected, _prostatus, _iniselected, _inistatus )

Handling Stepped Matrix and Displaying values based on Current Stepped Row Level.JPG

Best Regards

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Excellent, works like a charm!

There should be a cheatsheet with tricks like this (SWITCH; RETURN) as I never used it so cleverly.

Anonymous
Not applicable

Hi @Anonymous ,

You can create two measures as below, please find the details in the attachment:

RAG = 
VAR _iniselected =
    ISINSCOPE ( 'Table'[Initiative] )
VAR _proselected =
    ISINSCOPE ( 'Table'[Program] )
VAR _inirag =
    CALCULATE (
        MAX ( 'Table'[INI.RAG] ),
        ALLEXCEPT ( 'Table', 'Table'[Initiative] )
    )
VAR _prorag =
    CALCULATE (
        MAX ( 'Table'[PGM.RAG] ),
        ALLEXCEPT ( 'Table', 'Table'[Program] )
    )
RETURN
    SWITCH ( TRUE (), _proselected, _prorag, _iniselected, _inirag )
Status = 
VAR _iniselected =
    ISINSCOPE ( 'Table'[Initiative] )
VAR _proselected =
    ISINSCOPE ( 'Table'[Program] )
VAR _inistatus =
    CALCULATE (
        MAX ( 'Table'[INI.Status] ),
        ALLEXCEPT ( 'Table', 'Table'[Initiative] )
    )
VAR _prostatus =
    CALCULATE (
        MAX ( 'Table'[PGM.Status] ),
        ALLEXCEPT ( 'Table', 'Table'[Program] )
    )
RETURN
    SWITCH ( TRUE (), _proselected, _prostatus, _iniselected, _inistatus )

Handling Stepped Matrix and Displaying values based on Current Stepped Row Level.JPG

Best Regards

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors