Forum Discussion
or logic slicer
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
- sp88 years agoHelper II
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?
- v-jiascu-msft8 years agoMicrosoft Employee
- sp88 years agoHelper II
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.