Forum Discussion
Changing slicer logic to AND
- 6 years ago
Hi pboron,
kudos for a perfectly formulated post, with screen shots, pbix-file and well described desired outcome.
I think you can solve this by creating a measure which is equal to 1 for the IDs in 'Table' which corresponds to the selected values in the slicer with AND-logic. First delete the relationship between Table2 and Table3. Then create this measure:Filter Measure = IF ( ISFILTERED ( Table3[Criteria] ); COUNTROWS ( FILTER ( ADDCOLUMNS ( VALUES ( Table2[ID] ); "numberOfConcurrentCriterias"; COUNTROWS ( CALCULATETABLE ( FILTER ( Table2; [Criteria] IN VALUES ( Table3[Criteria] ) ) ) ) ); [numberOfConcurrentCriterias] = DISTINCTCOUNT ( Table3[Criteria] ) ) ); 1 )Then add this measure to the Filter pane of your visual and set the value to be equal to 1. Example pbix
Cheers,
Sturla
If this post helps, then please consider Accepting it as the solution. Kudos are nice too.
Hi pboron,
kudos for a perfectly formulated post, with screen shots, pbix-file and well described desired outcome.
I think you can solve this by creating a measure which is equal to 1 for the IDs in 'Table' which corresponds to the selected values in the slicer with AND-logic. First delete the relationship between Table2 and Table3. Then create this measure:
Filter Measure =
IF (
ISFILTERED ( Table3[Criteria] );
COUNTROWS (
FILTER (
ADDCOLUMNS (
VALUES ( Table2[ID] );
"numberOfConcurrentCriterias"; COUNTROWS (
CALCULATETABLE ( FILTER ( Table2; [Criteria] IN VALUES ( Table3[Criteria] ) ) )
)
);
[numberOfConcurrentCriterias] = DISTINCTCOUNT ( Table3[Criteria] )
)
);
1
)
Then add this measure to the Filter pane of your visual and set the value to be equal to 1. Example pbix
Cheers,
Sturla
If this post helps, then please consider Accepting it as the solution. Kudos are nice too.
Hi sturlaws
Kudos for your great solution!
I am working on something similar and I tried to implement this solution, but it didn't work. It's a simple 1 table 1 slicer:
I need to filter only IDs that would match all of the criteria in the slicer so esentially changich the default OR logic to AND. Would you be able to advise please?
Many thanks in advance!
data:
IDRule
| 1 | a |
| 2 | a |
| 2 | b |
| 3 | c |
| 3 | a |
| 3 | d |
| 4 | b |
| 4 | a |
| 5 | b |
| 6 | d |
| 6 | e |
| 7 | d |
| 7 | e |
| 7 | a |
| 7 | f |
| 7 | g |
| 8 | d |
| 8 | a |
| 9 | e |
| 10 | a |
| 10 | d |