Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

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()-...
  • Anonymous's avatar
    Anonymous
    8 years ago

    Hey Anonymous

     

    The OR clause should look like:

     

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

    Hope this helps,

    Parker

  • Anonymous's avatar
    Anonymous
    8 years ago

    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