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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jonclay
Helper IV
Helper IV

If field contains data = Yes, otherwise No

Hi everyone

I would like to have a slicer that contains Yes and No options which filter my table depending on whether a specific fields contain data or not (in this case the field is Street1).

So, if Street1 contains e.g. 20 High Street then the data will show in the table if the Slicer option of Yes is ticked. Conversely, it won't appear if the Slicer option of No is selected.

I started by adding a new Conditional Column against each record, but I feel there must be a better and more efficient way of doing this using DAX. I'd really appreciate any help that you could give me.

Many thanks
Jon

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

For this, if you want to use a slicer for Yes or No, the simplest solution is a calculated column along the lines of:

Contains Street? = IF(ISBLANK(Table[Street1]), "No", "Yes")

you then use this column for the slicer.

You can actually achieve this using DAX and a table containing values for Yes or No, but it is rather convoluted...

Or you can simply use the filter pane instead of a slicer (and no calculated column)

Or use buttons and bookmarks





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

2 REPLIES 2
PaulDBrown
Community Champion
Community Champion

For this, if you want to use a slicer for Yes or No, the simplest solution is a calculated column along the lines of:

Contains Street? = IF(ISBLANK(Table[Street1]), "No", "Yes")

you then use this column for the slicer.

You can actually achieve this using DAX and a table containing values for Yes or No, but it is rather convoluted...

Or you can simply use the filter pane instead of a slicer (and no calculated column)

Or use buttons and bookmarks





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Thank you so much, @PaulDBrown , that worked a treat 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.