Forum Discussion
Filtering a table by the same field multiple times
- 6 years ago
Hi ttpcap
1.
build a simple filter or slicer to show the total number of restaurants that offer both Pizza AND Salad and then then filter that by whether they are profitable or not?
->
Create new tables and create relationships
Item = VALUES('Table'[Menu Item]) Profit/Loss = VALUES('Table'[Profit/Loss])2.
what % of Restaurants are profitable when they offer a Sandwhich as Menu #1 and a Salad as Menu #2 vs. those that offer a Main as Menu #1 and a Main as Menu #2, etc etc.
for example: % of Restaurants are profitable when they offer a Main as Menu #1 and a Sandwhich as Menu #2
Create two new tables, which doesn't connect to any other table,
Add columns from the two tables into slicers,
then create measures
selected1 = IF(SELECTEDVALUE('Type1'[Item Type])=MAX('Table'[Item Type]),MAX('Table'[Menu #])) selected2 = IF(SELECTEDVALUE('Type2'[Item Type])=MAX('Table'[Item Type]),MAX('Table'[Menu #])) Measure = CALCULATE ( DISTINCTCOUNT ( 'Table'[estaurant Name] ), FILTER ( 'Table', ( ( 'Table'[Item Type] = SELECTEDVALUE ( 'Type1'[Item Type] ) && [selected1] = 1 ) || ( 'Table'[Item Type] = SELECTEDVALUE ( 'Type2'[Item Type] ) && [selected2] = 2 ) ) && 'Table'[Profit/Loss] = "P" ) ) / CALCULATE ( DISTINCTCOUNT ( 'Table'[estaurant Name] ), ALLSELECTED ( 'Table' ) )Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Just to clarify, the Profit (P) or Loss (L) applies only to the Restaurant. The table I printed had a typo for the first Menu Item for Restauant B. i.e. a Restauarant is either P or L for all menu #s, menu items, and menu types at that particular restaurant.