4
votes

I have a slicer with two values: "Accounting Date" and "Effective Date". How to always keep one value selected, NOT both selected or NOT both unselected.

On a screenshot below selected "Effective Date"

enter image description here

The slicer has "Single select" on, but I still able to select both values.

And now both values unselected. Thats what I am trying to prevent.

enter image description here

I created measure "DateTypeSelected" using SELECTEDVALUE but I dont think you can use measure in a slicer.

DateTypeSelected = SELECTEDVALUE('Date Type Slicer'[Date Type],"Effective Date")
4

4 Answers

3
votes

Unfortunately, I don't think there's a solution to this currently.

You can see that it's a popular request on the Power BI Ideas forum, so I'd recommend voting and leaving a comment there.

3
votes

As mentioned by Alexis Olson currently not possible, but to mitigate the problem, you can safeguard your measures from showing incorrect results, or display an error message if the user makes an invalid selection.

Create a measure like this, which will return TRUE if only a single value in the slicer is selected:

IsValidDateType = COUNTROWS(VALUES('Date Type Slicer'[Date Type])) = 1

And then you can adjust your measure like this:

MySum = IF([IsValidDateType], SUM(fact[value]), BLANK())

And you could create an error message measure like this, which could be added to a card to inform the user of invalid selection:

DateTypeErrorMsg = IF([IsValidDateType], " ", "Please select one, and only one, value for Date Selection.")
1
votes

Answering an old question for anyone who comes across here searching as I have. I was able to use the custom visual "Chiclet Slicer", which does allow you to always force exactly one selection, and looks comparable (possibly better) than the built in slicer.

enter image description here

Under the "General" tab, you'll need to turn off "Multiple Selection", and turn on "Forced Selection". enter image description here

0
votes

Having other things to worry about I solve it by SWITCH. If user chooses option A, be it accounting date, then it is A. Otherwise it is B. No matter if the user selects both A and B or none of them, it will be B. Put the selected value on a card so when the user plays with a slicer he will know what is chosen.

DateTypeSelected =
SWITCH (
    SELECTEDVALUE ( 'Date Type Slicer'[Date Type] ),
    "Effective Date", "Effective Date", 
    "Accounting Date" 
)

You can also do it with a slicer that has only one value. If you select that value then it is A, otherwise it is B. Just like turning off and on the light.