Here is a scenario where we need to filter the table based on slicer selection. The default behavior of slicer selection is OR operation but what I am trying to achieve is AND operation which is different than what has been explained by SQLBI https://www.youtube.com/watch?v=tONOosN1xAs&feature=youtu.be , have tried different ways to accomplish this but could not. The only table present is Main table though I have tried creating a another table with single value column.
Present …
Once you select more than 1 slicer data it filters using OR condition. i.e if I select A and B then it filters for the below column which contains A or B
What I am trying to achieve is it should reflect A and B i. the value which has both in the Data column.
Yes I would’ve used this method but we don’t restrict the user to select only 2. It needs to filter for all the selections. The actual data contains many value. And we can’t create so many slicers and ask user to keep selecting one value from each slicer.
See if this meets your requirement, if you don’t want this measure in your table (as img left) just place it in the filter pane as a visual level filter (result img on the right).
Yes partially but it was only working for 2 selection, but my requirement is n selection as below… my actual data has many values in some cell it is more than 20.
Melissa’s code worked for me and the above screen shot is after applying her solution…
But would really look forward to understand your code( if you have little time to expand on that) after I finish your recent blog about Context transition. I would really recommend for other users to read his awesome blog…
Thank you for your simple yet very powerful solution and it is working as per requirement, with little modification when there was no selection it was showing empty table.
FilterMeasure =
VAR rTest =
COUNTROWS ( ALLSELECTED ( Test[Data List] ) )
VAR mySelection =
VALUES ( Test[Data List] )
RETURN
IF (
OR ( COUNTROWS ( mySelection ) = rTest, NOT ( ISFILTERED ( Test[Data List] ) ) ),
1
)
Saw your DAX and it’s really amazing to see how you have modified the output based on slicer selection and really a great way to think what we can achieve with DAX.
My expectation were as follow.
Once user select any number of value from the slicer the table should filter for those values present on the single cell i.e
If select E then should show all the rows which has E
If user select more than 1 value then table should show which has minimum selected value i.e if user select A and E then it should show all the rows which has A and E in it as below.
If user select suppose 3 values then it should show data which has minimum those value…
And it goes on …
And below combination it shows no data
Hope the above explains what i was looking for but i really got so many different answers to have in the bucket
Here is the commented DaxStudio file Mukesh.dax (3.6 KB)
Regarding the Occurence part, I noticed a pattern so what I did is basically count how many time all of the IDs are repeating and for the final string only return values where Occurrence is equal to the number of values selected in the slicer