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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
brdrok
Helper I
Helper I

Hide/Show column dynamically depending if the total equals zero

Hi,

I have a table inside Power BI where two columns total to $0.00.  I would like to hide those two columns if/when the totals equals to $0.00

 

brdrok_0-1734470041479.png

Is that possible to do so in Power BI for the table visualization?  

 

Thank you,

2 ACCEPTED SOLUTIONS
danextian
Super User
Super User

Hi @brdrok 

You cannot hide a measure that's been added to a viz even if that measure returns a blank but you can with a column category. You will need a disconnected table that has a column, containing the measure names, which you can create with DAX or M/Enter data like below:

danextian_0-1734504631789.png

Then write a measure that switches to different measures depending on the category value

MeasureSwitch =
SWITCH (
    SELECTEDVALUE ( _values[Measures] ),
    "Revenue", [Total Revenue],
    "Transactions", [Total Transactions],
    "Dummy",
        VAR __Dummy =
            -- apply the same value to all category rows
            CALCULATE (
                [Dummy Measure],
                ALLSELECTED ( Category[Category] )
            )
        RETURN
            IF ( __Dummy <> 0, __Dummy )
)

ALL/ALLSELECTED must be applied to all the fields added to the row tile.

 

Notice that the first matrix has a column and a single measure only while the second one doesnt have a column but has three measures.

danextian_1-1734504804672.png

 

Please see attached sample pbix.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

Anonymous
Not applicable

Thanks for the reply from Irwan, please allow me to provide another insight.
Hi @brdrok ,

It is unlikely to be possible to implement autohide columns in the table visualization.
This usually requires manual control of column hiding with the help of field parameters.

Show/Hide Columns Dynamically Using Field Parameters — Power BI | by Monika Mishra | Microsoft Power...

 

However, this may be possible to realize in a matrix.

The test data table is as follows.

vdengllimsft_0-1734504455944.png


Create a calculation table that uses a column to contain the names of the columns that need to be dynamically hidden.

vdengllimsft_2-1734504813593.png

 

Create two measures.

 

Result = 
SWITCH(
    SELECTEDVALUE(ColumnName[columns]),
    "Test1",SUM('Table'[Test1]),
    "Test2",SUM('Table'[Test2]),
    "Test3",SUM('Table'[Test3])
    )
Value = 
IF(CALCULATE([Result],ALL('Table'[Date]))=0,BLANK(),[Result])

 

 

Create a matrix.
You can see that the format of the matrix is almost the same as the table visualization and that the columns with a Total of 0 are automatically hidden.

vdengllimsft_3-1734504915930.png

Please see the attached pbix for reference.

Best Regards,
Dengliang 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

7 REPLIES 7
brdrok
Helper I
Helper I

Hi @Anonymous  and @danextian .  Sorry for the late response.  Between being a newbie at Dax/Power BI and spending a "wonderful" afternoon at the dentist, it took me a little while to get the idea for the wonderful solutions.  Tried both and I kinda got it to work.  Still need to lear more but I got the idea.  Is there a way to accept more than one solution?

You should be able to accept multiple solutions.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Anonymous
Not applicable

Thanks for the reply from Irwan, please allow me to provide another insight.
Hi @brdrok ,

It is unlikely to be possible to implement autohide columns in the table visualization.
This usually requires manual control of column hiding with the help of field parameters.

Show/Hide Columns Dynamically Using Field Parameters — Power BI | by Monika Mishra | Microsoft Power...

 

However, this may be possible to realize in a matrix.

The test data table is as follows.

vdengllimsft_0-1734504455944.png


Create a calculation table that uses a column to contain the names of the columns that need to be dynamically hidden.

vdengllimsft_2-1734504813593.png

 

Create two measures.

 

Result = 
SWITCH(
    SELECTEDVALUE(ColumnName[columns]),
    "Test1",SUM('Table'[Test1]),
    "Test2",SUM('Table'[Test2]),
    "Test3",SUM('Table'[Test3])
    )
Value = 
IF(CALCULATE([Result],ALL('Table'[Date]))=0,BLANK(),[Result])

 

 

Create a matrix.
You can see that the format of the matrix is almost the same as the table visualization and that the columns with a Total of 0 are automatically hidden.

vdengllimsft_3-1734504915930.png

Please see the attached pbix for reference.

Best Regards,
Dengliang Li

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

danextian
Super User
Super User

Hi @brdrok 

You cannot hide a measure that's been added to a viz even if that measure returns a blank but you can with a column category. You will need a disconnected table that has a column, containing the measure names, which you can create with DAX or M/Enter data like below:

danextian_0-1734504631789.png

Then write a measure that switches to different measures depending on the category value

MeasureSwitch =
SWITCH (
    SELECTEDVALUE ( _values[Measures] ),
    "Revenue", [Total Revenue],
    "Transactions", [Total Transactions],
    "Dummy",
        VAR __Dummy =
            -- apply the same value to all category rows
            CALCULATE (
                [Dummy Measure],
                ALLSELECTED ( Category[Category] )
            )
        RETURN
            IF ( __Dummy <> 0, __Dummy )
)

ALL/ALLSELECTED must be applied to all the fields added to the row tile.

 

Notice that the first matrix has a column and a single measure only while the second one doesnt have a column but has three measures.

danextian_1-1734504804672.png

 

Please see attached sample pbix.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
brdrok
Helper I
Helper I

Hi @Irwan ,

thank you for your response.  If I am reading it right, it's suppressing the row that is 0, right?  If so, what I would like to accomplish instead is to hide a column if the total equals to $0.00.

hello @brdrok 

 

i am not sure but hiding a column is not likely to be done since you add those column to your visual.

 

Thank you.

Irwan
Super User
Super User

hello @brdrok 

 

is it plausible to do it with visual filter in your case?
here is a simple example:
- before filter

Irwan_0-1734471056118.png

- after filter

Irwan_1-1734471106233.png

 

Hope this will help.

Thank you.

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 Solution Authors