Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
UsePowerBI
Post Prodigy
Post Prodigy

CALCULATE with multiple OR/AND criteria

Hello

 

Can you tell me please how to use the CALCULATE formula with multiple OR/AND criteria?

 

Thanks!

 

 

1 ACCEPTED SOLUTION
EricHulshof
Solution Sage
Solution Sage

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.


Quality over Quantity


Did I answer your question? Mark my post as a solution!


View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@UsePowerBI , 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"))

EricHulshof
Solution Sage
Solution Sage

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.


Quality over Quantity


Did I answer your question? Mark my post as a solution!


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.