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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Calculation with OR

I want to calculate the following measure:

 

Calculate the total number of people last year with or conditions.

 

Ex: Total Number = CALCULATE(COUNT(Table[Total]), YEAR(Table[DATE])=YEAR(TODAY()-1) && (Table[REASON]="Not well" or "Left the job") && Table[Gender]="F"))

 

I am not sure about my OR part of the measure as it thrown an error.  Basically, what I am trying to calculate is total number which is based on last year and if Reason = Not well or left the job and Gender = Female. 

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hey @Anonymous

 

The OR clause should look like:

 

(Table[REASON]="Not well" || Table[REASON]="Left the job")

Hope this helps,

Parker

View solution in original post

Anonymous
Not applicable

Hi @Anonymous

 

As mentioned @Anonymous, the OR syntax needs to be changed. Also, the last year part wont retun as expected in your code, you need to change the code as below:

Total Number = CALCULATE(COUNT(Table[Total]), 
      YEAR(Table[DATE])=YEAR(TODAY())-1  
      && (Table[REASON]="Not well" ||Table[REASON]="Left the job") 
      && Table[Gender]="F"))

Thanks

 

Raj

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous

 

As mentioned @Anonymous, the OR syntax needs to be changed. Also, the last year part wont retun as expected in your code, you need to change the code as below:

Total Number = CALCULATE(COUNT(Table[Total]), 
      YEAR(Table[DATE])=YEAR(TODAY())-1  
      && (Table[REASON]="Not well" ||Table[REASON]="Left the job") 
      && Table[Gender]="F"))

Thanks

 

Raj

Anonymous
Not applicable

Thank you @Anonymous @Anonymous!

Anonymous
Not applicable

Hey @Anonymous

 

The OR clause should look like:

 

(Table[REASON]="Not well" || Table[REASON]="Left the job")

Hope this helps,

Parker

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.