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
shashank
Helper III
Helper III

Compulsory single select in filter

Hi Team,

 

just wanted to check can we make sure some how that user select single value(it's must that user should always select some value) in filter ?

8 REPLIES 8
zsloane
Frequent Visitor

I have a similar use case. My workaround is to use wrapper measures on the report page that require a single selection in a slicer before they will calculate anything. You can test for the single selection using the HASONEFILTER() function against the field used in the slicer. If FALSE, the measure can then return BLANK() or some text message for the user (if the visual can display text).

Anonymous
Not applicable

Hello,

 

There is no option to disable "Select all" or to have a force selection in a slicer. But i have developed a workaround to hide all the data. Create 2 measures as below. (similar solution as mentioned by zsloane.)

 

Valid_selection = if(HASONEVALUE(Slicer_attribute), "", "Error: Select a Single value")

Valid_selection_numeric = if(HASONEVALUE(Slicer_attribute), 1, 0)

 

Pull the first measure into a card, which will be blank when a single value is selected and will throw an error message when it is more than one/All.

 

Second measure to be added as a visual level filter, add Valid_selection_numeric = 1 as visual level filter on all the visuals. Which means, the data will be displayed only when a single value is selected. 

Nothing but hiding the data for all.

 

Let me know if you have any questions.

 

Hope this helps.

v-huizhn-msft
Employee
Employee

Hi @shashank,

Your filter means the slicer? If it is, you want to let user only select the single value as well as can't select multiple values at once? Actually, we select one value once in slicer by default. Only you select CTRL, you can select multiple values.

Best Regards,
Angelia

Hi Angelina,

 

thanks for your reply, my question was in context of any type of filter be it normal filter in power bi or slicer..i want to resetrict to user that they are able to choose only one value at any point of time.

 

i observe that if user does not select any single item then it become "All" but i want that user must select one and only one any value , is there any work around ?

Hi @shashank,

When user select nothing, you want it shows nothing. Otherwise, the user only select one value and display the corresponding results? If my understanding is right, it's impossible to display nothing when no value is selected. When no value is selected, it shows "All" values. The slicer is used to filter rows in Power BI desktop.

Best Regards,
Angelia

Hi,

 

i'm not talking specifically about slicer , i'm talking about normal filter.

 

i want user to resetric that user always select one and only one value.

 

Niether "ALL" nor "Nothing"

 

hope it's clear.

Hello everyone,

 

i'm still waiting for any convining reply on that either "Yes" or "No" or any other work around of that ?

Hi @shashank,

Until now, we can not set the slicer feature by ourselves. The use can choose one or mutiple values in slicer. When no value is selected, the report shows all values.

Best Regards,
Angelia

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.