Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Hide column conditionally

https://drive.google.com/file/d/1xuZ-nFqetmKsjVW1EI4_VLMLSBV7feAD/view?usp=sharing

 

In the file attached,

 

Is there any way in which if Actuals is 0, hide the column itself, 

 

Desired output,

 

 

I think its impossible, but still asking because that came up as a requirement

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

    There is no better way to hide the "column" base on the specific conditions, you can follow the suggestion by amitchandak to unpivot the columns "Actuals" and "Forecasts", then create a matrix visual(Columns: Date hierarchy: Year, Month name & Attribute   Values: Value). Please find the details in the attachment.

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ZY9RCsQwCETv4nchjqaNniX0/teo1WR3YfFjYB7xmTlJG9CE4XQQmDnCPIbuY1JvsA0lGUQhyc4m52ae7IOu1oPI241rjAgFNNEoXTJnfyN7K1P22ntfKq2FXq7aaMP2K/ACiKbOg0iZ9A/p2iY/BOmLWf/9EknJ/QA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Actuals = _t, Forecast = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Actuals", Int64.Type}, {"Forecast", type number}}),
        #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Date"}, "Attribute", "Value"),
        #"Filtered Rows" = Table.SelectRows(#"Unpivoted Columns", each ([Value] <> 0))
    in
        #"Filtered Rows"

    In addition, you can review the content in the following threads, hope they can help you resolve the problem.

    Hide/do not display empty columns in a matrix visual

    Hide column in table visual if contents are 0

    Best Regards

2 Replies

  • Anonymous , You are correct as long it is a measure or column you can not hide it. You have to unpivot and make it as row value to hide

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    There is no better way to hide the "column" base on the specific conditions, you can follow the suggestion by amitchandak to unpivot the columns "Actuals" and "Forecasts", then create a matrix visual(Columns: Date hierarchy: Year, Month name & Attribute   Values: Value). Please find the details in the attachment.

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ZY9RCsQwCETv4nchjqaNniX0/teo1WR3YfFjYB7xmTlJG9CE4XQQmDnCPIbuY1JvsA0lGUQhyc4m52ae7IOu1oPI241rjAgFNNEoXTJnfyN7K1P22ntfKq2FXq7aaMP2K/ACiKbOg0iZ9A/p2iY/BOmLWf/9EknJ/QA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Actuals = _t, Forecast = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Actuals", Int64.Type}, {"Forecast", type number}}),
        #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Date"}, "Attribute", "Value"),
        #"Filtered Rows" = Table.SelectRows(#"Unpivoted Columns", each ([Value] <> 0))
    in
        #"Filtered Rows"

    In addition, you can review the content in the following threads, hope they can help you resolve the problem.

    Hide/do not display empty columns in a matrix visual

    Hide column in table visual if contents are 0

    Best Regards