Forum Discussion
CALCULATE with multiple OR/AND criteria
Hello
Can you tell me please how to use the CALCULATE formula with multiple OR/AND criteria?
Thanks!
- Anonymous6 years ago
When you add two filters to the CALCULATE Function, this is equavalient to using AND. So if you wanted to get the Direct or Referral Channels. You will need to use the || to create OR in CALCULATE and FILTER
Direct OR Refferal Sessions = CALCULATE(SUM('All Web Site Data'[Sessions]), FILTER('All Web Site Data','All Web Site Data'[Default Channel Grouping]="Direct" || 'All Web Site Data'[Default Channel Grouping]="Referral"))When you want to use the OR condition, Use FITLER with CALCULATE.
2 Replies
- AnonymousNot applicable
When you add two filters to the CALCULATE Function, this is equavalient to using AND. So if you wanted to get the Direct or Referral Channels. You will need to use the || to create OR in CALCULATE and FILTER
Direct OR Refferal Sessions = CALCULATE(SUM('All Web Site Data'[Sessions]), FILTER('All Web Site Data','All Web Site Data'[Default Channel Grouping]="Direct" || 'All Web Site Data'[Default Channel Grouping]="Referral"))When you want to use the OR condition, Use FITLER with CALCULATE.
- amitchandak
Super User
Anonymous , you have AND and OR function
You can use && for and; and || for or
example = calculate([measure],filter(Table, Table[A] =1 || Table[B] ="A"))