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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

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:

product available.png

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):

 

product not available.png

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!

1 ACCEPTED SOLUTION
danextian
Super User
Super User

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.

danextian_0-1648294253639.png

danextian_1-1648294487235.png

 

 










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


Proud to be a Super User!









"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

2 REPLIES 2
danextian
Super User
Super User

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.

danextian_0-1648294253639.png

danextian_1-1648294487235.png

 

 










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


Proud to be a Super User!









"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 so much - this was exactly what I was looking for!

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.