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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Condition that checks if a matrix is collapsed, in order to display column data dynamically?

Hi everyone, I am fairly new to PowerBI but I have been enjoying my learning experience so far. I have been stuck on a problem though and was hoping someone might have any ideas.

 

I have an Excel with 4 columns (this is all test data):

  1. Category
  2. Sub-Category
  3. Description
  4. Sub-Category Description

I have the data displayed in a matrix visual that has the ability to collapse the Categories into their respective Sub-Categories. I am trying to figure out how to have just one "Description" column that:

  1. When uncollapsed (Category level), shows the "Description"
  2. When collapsed (Sub-Category level), shows the "Sub-Category Description".

 

IMG_0228.PNGIMG_0227.PNG

 

I was hoping that there would be an "isCollapsed" type condition I could use but I could not find a solution to this. 

 

Thanks so much in advance to any help.

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

Hi @Anonymous ,

 

Please create a measure like below and put it into "Values" of Matrix.

Measure =
IF (
    HASONEVALUE ( 'Table'[Sub-Category] ),
    MAX ( 'Table'[Sub-Description] ),
    IF ( HASONEVALUE ( 'Table'[Category] ), MAX ( 'Table'[Description] ), "NULL" )
)

1.gif

 

 

Best Regards,
Xue Ding
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

2 REPLIES 2
v-xuding-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please create a measure like below and put it into "Values" of Matrix.

Measure =
IF (
    HASONEVALUE ( 'Table'[Sub-Category] ),
    MAX ( 'Table'[Sub-Description] ),
    IF ( HASONEVALUE ( 'Table'[Category] ), MAX ( 'Table'[Description] ), "NULL" )
)

1.gif

 

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks so much! This is exactly what I was trying to figure out.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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