Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hello,
When I do a multiple selection in a slicer, I would choose the condition (AND / OR) for that selection. How can I do?
Example:
I have this filter:
Slicer |
A |
B |
C |
D |
E |
And this table:
Code | Atrtibute |
Code1 | A |
Code2 | B |
Code3 | A |
Code4 | C |
Code5 | C |
Code6 | A |
Code1 | B |
Code2 | B |
Code3 | E |
Code1 | D |
Code2 | A |
Code3 | C |
Code4 | B |
Code5 | E |
Code6 | A |
If I select "A" "B" from the slicer, than I would choose the condition "AND" (having code1, code2, code3, code6) or the condition "OR" (having code1, code2).
Thank you.
Solved! Go to Solution.
Hi @Anonymous ,
In your scenario, we can create another table with values "AND", "OR" to create a slicer, then create a distinct table with the Distinct() function, then we cna create a measure to judge it:
Measure = var a = CONCATENATEX(FILTER(ALL('Table'),'Table'[Code] = MIN('Table'[Code])),'Table'[Atrtibute],"") var b = IF(MIN('Table'[Atrtibute]) in ALLSELECTED(Table2[Slicer]),1,0) var c = IF(a = CONCATENATEX(ALLSELECTED(Table2[Slicer]),Table2[Slicer],""),1,0) return IF(SELECTEDVALUE(Table3[Column1]) = "AND", c,b)
By the way, the logic of your "AND", "OR" is strange, generally, when I select "OR" and "AB", it should return 1,2,3,4,6.
Best Regards,
Teige
Hi @Anonymous ,
In your scenario, we can create another table with values "AND", "OR" to create a slicer, then create a distinct table with the Distinct() function, then we cna create a measure to judge it:
Measure = var a = CONCATENATEX(FILTER(ALL('Table'),'Table'[Code] = MIN('Table'[Code])),'Table'[Atrtibute],"") var b = IF(MIN('Table'[Atrtibute]) in ALLSELECTED(Table2[Slicer]),1,0) var c = IF(a = CONCATENATEX(ALLSELECTED(Table2[Slicer]),Table2[Slicer],""),1,0) return IF(SELECTEDVALUE(Table3[Column1]) = "AND", c,b)
By the way, the logic of your "AND", "OR" is strange, generally, when I select "OR" and "AB", it should return 1,2,3,4,6.
Best Regards,
Teige
Hi @TeigeGao, thank you for the reply.
You're right, I wrote a wrong thing. I would say: If I select "AB" from the slicer, then I select "AND" it should return code1, code2 while selecting "OR" it should return code1, code2, code3, code4, code6.
By the way, I can't replicate your indications.
I think I'm missing something.
So, I have: Table (Code, Attribute) ; Table2 (Slicer) - that has unique values of the column attribute- ; Table3 (Slicer Option)
Code | Atrtibute |
Code1 | A |
Code2 | B |
Code3 | A |
Code4 | C |
Code5 | C |
Code6 | A |
Code1 | B |
Code2 | B |
Code3 | E |
Code1 | D |
Code2 | A |
Code3 | C |
Code4 | B |
Code5 | E |
Code6 | A |
Slicer |
A |
B |
C |
D |
E |
Slicer Option |
AND |
OR |
Then I created the measure as you suggest:
Hi @Anonymous ,
We need to use distinct() function to create a calculated table whose name is "Table", then we can create the measure.
Best Regards,
Teige
User | Count |
---|---|
127 | |
108 | |
99 | |
63 | |
62 |
User | Count |
---|---|
136 | |
113 | |
102 | |
71 | |
60 |