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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
samantha75
Frequent Visitor

how to set matrix row expand enable/disable conditionally financial statement

Hi Everyone

I have a P&L table as below with some categories like Net Sales and Gross Profit that should show only one row without expand. For example Net Sales below should not expand and show one row

image_2024-07-16_062346603.png

The format is driven by an excel template as below and I intend to include a column for expand

statement.png

What is the best way to achieve the conditional expand?

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

Hi,@samantha75 . I am glad to help you.
According to your description
You want to specify that a specific row stored in the matrix has a drill-down effect (putting other columns under that column hierarchy)
while some other fields in that column do not have a drill-down effect.
Unfortunately, with the default matrix provided by power BI, setting a hierarchical drill-down for a field has an effect on all the data in that column, so you can't disable the drill-down for certain values that meet the conditions individually.
Here is my alternative
You can write a new measure to judge the matrix hierarchy to control the displayed value, according to your description, you don't want to expand the hierarchical data under the Net Invoice Sales and Net Sales columns, so you can use the Switch/IF function to judge, when the current row is filtered by the hierarchical fields under these two columns, display blank, otherwise it will be normal. Display the original value
You need to use the HASONEVALUE() function or ISINSCPOE() function to determine the level of the matrix.
Here is my test, hope it can help you.

 

M_Base Amount = 
SWITCH(
    TRUE(),
    HASONEVALUE('Report'[level_]) && 
    (MAX('Report'[ReportSection]) = "Net Invoice Sales" || MAX('Report'[ReportSection]) = "Net Sales"), 
    BLANK(),
    SUM('Report'[value_])
)

 

vjtianmsft_0-1721102129917.png

vjtianmsft_0-1721102386314.png

 


Here is my test data:

vjtianmsft_1-1721102179499.png

 

It should be noted that the above is my test data based on the screenshots you provided, you need to create a new measure based on the data in your actual environment, not directly use the measure I provided, because everyone's computing environment is inconsistent, and the measure will be affected by different computing environments to display different values.
Because everyone's computing environment is not the same, and the measure will be affected by different computing environment to display different values.


Since the default matrix provided by power BI does not support the setting of some fields to prohibit the expansion of the drill-down function, you can go to the mall to look for a suitable custom visual, to see if there is a custom matrix visual available to meet your needs.

vjtianmsft_2-1721102209343.png

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
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

1 REPLY 1
v-jtian-msft
Community Support
Community Support

Hi,@samantha75 . I am glad to help you.
According to your description
You want to specify that a specific row stored in the matrix has a drill-down effect (putting other columns under that column hierarchy)
while some other fields in that column do not have a drill-down effect.
Unfortunately, with the default matrix provided by power BI, setting a hierarchical drill-down for a field has an effect on all the data in that column, so you can't disable the drill-down for certain values that meet the conditions individually.
Here is my alternative
You can write a new measure to judge the matrix hierarchy to control the displayed value, according to your description, you don't want to expand the hierarchical data under the Net Invoice Sales and Net Sales columns, so you can use the Switch/IF function to judge, when the current row is filtered by the hierarchical fields under these two columns, display blank, otherwise it will be normal. Display the original value
You need to use the HASONEVALUE() function or ISINSCPOE() function to determine the level of the matrix.
Here is my test, hope it can help you.

 

M_Base Amount = 
SWITCH(
    TRUE(),
    HASONEVALUE('Report'[level_]) && 
    (MAX('Report'[ReportSection]) = "Net Invoice Sales" || MAX('Report'[ReportSection]) = "Net Sales"), 
    BLANK(),
    SUM('Report'[value_])
)

 

vjtianmsft_0-1721102129917.png

vjtianmsft_0-1721102386314.png

 


Here is my test data:

vjtianmsft_1-1721102179499.png

 

It should be noted that the above is my test data based on the screenshots you provided, you need to create a new measure based on the data in your actual environment, not directly use the measure I provided, because everyone's computing environment is inconsistent, and the measure will be affected by different computing environments to display different values.
Because everyone's computing environment is not the same, and the measure will be affected by different computing environment to display different values.


Since the default matrix provided by power BI does not support the setting of some fields to prohibit the expansion of the drill-down function, you can go to the mall to look for a suitable custom visual, to see if there is a custom matrix visual available to meet your needs.

vjtianmsft_2-1721102209343.png

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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