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
vanya_val
Frequent Visitor

Slicer to show selected value AND blank values

Hi all,

 

I have a slicer in my data with the following options:

 

   (Blank)

   Option 1

   Option 2

   Option 3

 

When a user selects any of the options 1-3, I want the result to always display both the selected value and blank values as well. 

 

Is there a way to achieve this through DAX? 

 

Any help is much appreciated!!

6 REPLIES 6
v-xuding-msft
Community Support
Community Support

Hi @vanya_val ,

 

Does it make sense? If yes, please accept it as solution. More people will benefit here.

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-xuding-msft  Thank you for this. The solution you linked looks perfect for my problem but for some reason I can't make it work! It's probably something in my model, I'll do a bit more testing and post an update.

v-xuding-msft
Community Support
Community Support

Hi @vanya_val ,

 

Please reference the similar thread: Always select Blank in the Filter  to have a try.

 

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@vanya_val , Make sure these option are part of separate table/dim

Try new measure

Measure =
var _sel = selectedvalue(Dim[Dim1])
return
calculate(Sum(Table[Value]),filter(All(Dim),Dim[Dim1] =_sel || isblank(Dim[Dim1])))

 

Or

 

Measure =
var _sel = allselected(Dim[Dim1])
return
calculate(Sum(Table[Value]),filter(All(Dim),Dim[Dim1] in _sel || isblank(Dim[Dim1])))

Thanks very much @amitchandak for your reply.

 

I'm afraid I'm not sure how to apply the measure you suggested to the slicer, maybe I'm doing something wrong. Rather than summing the values, I am looking to filter a table visual with the slicer.

 

For example, I have a table visual showing a list of Products and their Colour. The Colour could be Red, Blue, Green or (Blank). When I select Green on the slicer I want the table visual to be filtered to show all products with colour Green or (Blank). But rather than summing up a value related to those products I just need to see a list of them. It sounds like I need a measure to say whether something is selected or blank, but I'm not sure how to write that in DAX.

 

@vanya_val  If you want to create a measure to check if something is selected or not. You can create a calculated measure like below

 

Selected_Yes_No = IF(HASONEFILTER(Color_Tab[Color]), "Selected Yes", "Nothing selected")
 
If you want to achieve something else, please let us know



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



Proud to be a Super User!


Follow me on linkedin

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.