Default Slicer Selection


#1

I have to meet a condition that when there is no selection in the slicer load only current year’s data otherwise filter data as per slicer selection. To achieve this, I have used “AllSelected” to find out if the count rows is same as the items in the slicer column. However, This condition becomes true at 2 cases

  1. When there is no selection in the slicer/
  2. When all items are selected (I want to avoid this)

In first case I am loading the current year’s data, in the latter i need to load all the data. Is there a way to achieve this? my DAX queries as below. Thanks.

Default Selection = COUNTROWS(DISTINCT(ALLSELECTED(‘Year’[KPIYEAR])))
All Selection = COUNTROWS(DISTINCT(ALL(‘Year’[KPIYEAR])))
Year Selection Count = IF([Default Selection] = [All Selection], 1 ,0)


#2

Hi @sripalavi,

For this one, you need to create some logic to the filter in your selection and create a measure that gets that year if nothing is selected.

I couldn’t find any video specific for dates, but here are two examples that you can watch on Enterprise DNA materials that are very similar to what you are trying to accomplish:

These two gets an slicer and when nothing is selected brings a default value, which I understand is what you are trying to accomplish here.

Let me know if this helps you.

Best regards,

Jorge Galindo


#3

Hi,
Thanks for responding. I went through the videos but these tips doesn’t help in my scenario. Both the videos deals slicer having single selection only. I am looking for,

1.A slicer with multiple selections allowed
2. when nothing is selected show data for current year (This is achieved)
3. When all the selected show data for all (How to?)

I am not really sure how to achieve the 3rd item above since slicer treats “No selection” and “All selection” the same way


#4

Hi @sripalavi,

I think for your scenario what you need is a logic function called ISFILTERED that returns true if a context in filtered and the use the IF statement to work around those filters. Here is the video:

If this doesn’t help you, can you get me a dummy pbix file to see what you are working with and what are you trying to achieve?

Best regards,

Jorge Galindo