Forum Discussion
Filter a measure using value from another slicer
- 3 years ago
What do you want to show if nothing is selected in the slicer?
You could use an if statement and hasonevalue to determine if the slicer has a single selection. If it doesn't, then return whatever default value you want.
https://learn.microsoft.com/en-us/dax/hasonevalue-function-dax
You could also try using chiclet slicer (download the visual) and force a selection in the slicer so it is never blank.
Hi nelalx ,
Not sure you need to do this. What happens if you just create a measure with Distinctcount of device id and put that in your visual. Does the measure value change when county slicer changes?
Actually i am facing a more complex issue and I tried this as a solution. The below is my relationships.
I am trying to find the unique deviceids when a slicer of country from the country field is applied. The devicedetails table also has a country field named DCountry, but i am not able to filter the value. Hence i tried to capture the value from slicer which uses the country field from country table and apply it on devicedetails table.
I am able to get it to work now , it looks like the country field in devicedetails table had some spaces. a trim helped it. But can you pleasse tell me how to handle the default case. I mean if no value is selected in slicer, i am having the card shown as blank.
- djurecic3 years ago
Super User
What do you want to show if nothing is selected in the slicer?
You could use an if statement and hasonevalue to determine if the slicer has a single selection. If it doesn't, then return whatever default value you want.
https://learn.microsoft.com/en-us/dax/hasonevalue-function-dax
You could also try using chiclet slicer (download the visual) and force a selection in the slicer so it is never blank.