Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Showing hiding visuals using DAX?

Hi everyone,

 

Currently I am facing the following scenario/problem:

 

When a product is available (using the text filter function), I would like to show the number of that product that is available using a bar chart:

However, when a product is not available (i.e., count product = 0), I would like to show a text message (instead of the bar chart):

 

Anyone have an idea how to implement this? I guess I have to use some DAX formula here, but am not sure how. 

 

Thanks in advance!

  • Hi Anonymous ,

    I don't think that completely hiding a visual is currently supported but there is a work around to make it appear so.
    I would create a measure that will return a text string if the value of another measure is blank(). Something like:

    ErrorMeasure =
    IF (
        [TestMeasure] = BLANK (),
        "This product is no longer available. Please select something else.",
        ""
    )


    I'd place this error measure in a single row card,  disable the category label and position it at the back of the bar chart. The bar chart should not have a background/transparent.

     

     

2 Replies

  • Hi Anonymous ,

    I don't think that completely hiding a visual is currently supported but there is a work around to make it appear so.
    I would create a measure that will return a text string if the value of another measure is blank(). Something like:

    ErrorMeasure =
    IF (
        [TestMeasure] = BLANK (),
        "This product is no longer available. Please select something else.",
        ""
    )


    I'd place this error measure in a single row card,  disable the category label and position it at the back of the bar chart. The bar chart should not have a background/transparent.

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks so much - this was exactly what I was looking for!