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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
SeniorJunior
Frequent Visitor

Dynamic hiding of a column based on a user slicer selection

Hi all, 

 

I have carried out things similar to this previously with bookmarks, but in this instance I am not quite sure that would fit within the current report environment. 

 

I have a report, and when the product type equals "Software" I'd like for a column called "Warranty" to be hidden; but when product type equals anything else I'd like the "Warranty" column to be shown.

 

The data is currently in a table and filtered by a dropdown slicer. 

 

I have thought about creating a DAX query and conditional formatting to hide the text in the "Warranty"column when the selection is "Software", but that would leave a blank column which may look odd - and as mentioned at the start, previously I would have used a bookmark navigator and two tables as a way around this, but I'd really like to keep all the options within the single dropdown slicer if at all possible. 

 

Any thoughts welcome! 

1 ACCEPTED SOLUTION
Kedar_Pande
Super User
Super User

@SeniorJunior 

Create a measure to control the display:

ShowWarranty = 
IF(
SELECTEDVALUE('YourTable'[Product Type]) = "Software",
BLANK(),
MAX('YourTable'[Warranty])
)

This will hide the data in the "Warranty" column when "Software" is selected, but the column itself will remain visible (as a blank).

 

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

View solution in original post

5 REPLIES 5
v-xinruzhu-msft
Community Support
Community Support

Hi,

Thanks for the solution shafiz_p  and Kedar_Pande  offered, and i want to offer some more information for user to refer to.

hello @SeniorJunior , based on your description, it is better that use two tables, you can refer to the following sample.

Sample data 

Product Type table.

vxinruzhumsft_0-1732588173045.png

 

Data table

vxinruzhumsft_1-1732588187033.png

You can create a columnname table.

vxinruzhumsft_2-1732588213602.png

Then creaete a measure.

MEASURE =
SWITCH (
    SELECTEDVALUE ( 'Table'[Columnname] ),
    "Value2", CALCULATE ( MAX ( 'Value'[Value2] ) ),
    "Value3", CALCULATE ( MAX ( 'Value'[Value3] ) ),
    "Warranty",
        IF (
            SELECTEDVALUE ( 'Product Type'[Product Type] ) <> "Software",
            MAX ( 'Value'[Warranty] )
        )
)

Then create a matrix visual ,and input the following field the matrix.

vxinruzhumsft_3-1732588338796.png

 

Outptut

vxinruzhumsft_4-1732588356378.png

 

vxinruzhumsft_5-1732588364576.png

 

Best Regards!

Yolo Zhu

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

This is an interesting approach, I have started with the measure approach which hides values but keeps the column, but this is also interesting as a way to address the query. 

 

Thank you

shafiz_p
Super User
Super User

Hi @SeniorJunior 
Unfortunately, Power BI does not natively support hiding column except field parameter. Through field parameter you would be able to show/hide matrix visual column. You can show blank value upon software selection in slicer.

Kedar_Pande
Super User
Super User

@SeniorJunior 

Create a measure to control the display:

ShowWarranty = 
IF(
SELECTEDVALUE('YourTable'[Product Type]) = "Software",
BLANK(),
MAX('YourTable'[Warranty])
)

This will hide the data in the "Warranty" column when "Software" is selected, but the column itself will remain visible (as a blank).

 

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

Perfect - and quite straightforward to implement and explain, thank you! 

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Kudoed Authors