Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Is there a way to implement OR logic between 2 slicers?
I have a table with multiple columns and I want to be able to see items that meet either of the 2 criteria.
Example:
Type Color Other columns....
A Red
A Blue
A Green
B Red
B Red
B Green
I want to see anything on my resulting chart that is EITHER red OR Type A (5 results here). My graphs still need to maintain all of the data from the "other columns," like a regular slicer, so I can't just get an overall sum.
Thanks.
if you create a new, separate tables for Color & Type, and use them for slicers (without joining them with original table), then this syntax should work:
Measure = VAR Summary = SUMMARIZE(ALL('Table'),'Table'[Color],'Table'[Type]) VAR FilteredSummary = FILTER( Summary, [Color] IN VALUES(Color[Color]) || [Type] IN VALUES('Type'[Type]) ) RETURN CALCULATE(SUM('Table'[Value]),FilteredSummary)
replace the blue syntax with whatever measure you want to show on the visuals
Thanks.
Once I changed SUM to COUNT, I was able to get it working on visuals that only used fields from that original table.
As soon as I added a field from a different table (with relationship to the first), the filter was basically removed and the table went back to showing all of the data.
I tried adding the measure to a slicer so that I could force it to only see where the measure was 1, but that's apparently not allowed.
Any further suggestions?
Hi @sp8,
Can you share a dummy sample please?
Best Regards,
Dale
Product table:
Type Color Serial No
A Red 1
A Blue 2
A Green 3
B Red 4
B Red 5
B Green 6
Sales Table:
Serial No Customer Month
1 Bob March
2 Joe April
3 Bob April
4 Sue May
5 Bob May
6 Joe May
I want to see a table visual/chart that shows sales (by customer) of anything RED or type A.
When I use the code suggested and only use the Product Table, everything is great.
When I add the "by Customer" information from the Sales Table, suddenly I can see all of the entries, not just the items that are red or type A.
In the table visual, if I add the measure as a column name, it does show "'1" for anything in my OR filter and blank for anything not in my OR filter. But, they are still shown on the visual.
Hi @sp8,
How about adding a new column to the table Product?
Slicer = IF ( [Type] = "A" || [Color] = "Red", "meet", "miss" )
Best Regards,
Dale
How would that work, considering I have a wide variety of choices for type and color? Are you suggesting a column for each permutation and a slicer for each column?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
94 | |
83 | |
66 | |
59 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |