Forum Discussion
Calculate with multiple criteria
Thanks
Pravin
If it resolves your problem mark it as a solution and give Kudos
- lyonslat6 years agoFrequent Visitor
Hi Pravin,
Thanks for your input, it's much appreciated.
Unfortunatley this didn't quite work the way I expected it to.
The result I'm looking for is to show the number of transactions that contain both Food and Beer. The result that your suggestion put forward, gives me a number of the transactions that contain either food or beer and totals them up.
Any suggestions?
Thanks,
Ben
- lyonslat6 years agoFrequent Visitor
The best way I can describe this is if you imagine a venn diagram of transactions.
One side has food transactions, the other has beer, and in the middle you have the number of distinct transactions that contain both food and beer.
- Anonymous6 years agoNot applicable
hi lyonslat
Create below measure
Flag =var food=CALCULATE(COUNT(Sheet1[profit_center_id]),allexcept(Sheet1,Sheet1[profit_center_id]),Sheet1[revenue_category_name]="FOOD")Var beer=CALCULATE(COUNT(Sheet1[profit_center_id]),allexcept(Sheet1,Sheet1[profit_center_id]),Sheet1[revenue_category_name]="BEER")returnIF(food>0 && beer>0,1,0)And add this measure to visual level filter of table and set it to 1.Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar
If I resolve your problem Mark it as a solution and give kudos.- HotChilli6 years ago
Community Champion
You could use INTERSECT in the following
MeasureFoodAndBeer = VAR _FoodChecks = CALCULATETABLE (VALUES ( TableBill[check_number] ), TableBill[revenue_category_name] = "Beer") VAR _BeerChecks = CALCULATETABLE (VALUES ( TableBill[check_number] ), TableBill[revenue_category_name] = "Food") RETURN COUNTROWS(INTERSECT(_BeerChecks, _FoodChecks))If you want to break this down and test it, you can materialise each of the tables by creating a table (New Table) with the CALCULATETABLE code. You can then look at the table in data view.