Conditionally hide column in a Matrix - Powerbi desktop

Viewed 3671

Has anyone found a cool solution for this problem?

I have a table like below.

I want to completely hide the pre or post columns if there are no values in them. So in the screenshot the desired result would be that the first two Post columns, for Oct and Nov, would be hidden and the Pre column for Jan would also be hidden.

I read about using visual level filters but as it is a matrix and not a singular column this doesn't work.

enter image description here

The amount value is already using a switch for measure selection.

In case you can't see the image. Rows are categories, columns has date and I have two measures one called pre and one called post. Most and the time if pre is full, post is empty vice versa except for 1 or 2 months overlap

1 Answers

It's not great but I have a workaround.

Create a new dimension table DimMeasure (with no relationships):

Measure
--------
Pre
Post

Write a switching measure that picks [Pre] or [Post] based on the new dimension.

PrePost = IF ( SELECTEDVALUE ( DimMeasure[Measure] ) = "Pre", [Pre], [Post] )

Add DimMeasure to you columns in the matrix below the month and [PrePost] to the values instead of the two component measures.

Related