Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Dax Measure with conditions

I have the following data

I need to show the output as follows:

the logic is - count of those ID's whose status IS NOT "Closed/Completed" and "Closed/Cancelled". 

I tried creating a measure as follows:

calculate(count(Table[ID]), status = "Assigned", staus = "New", status = "Pending Change", Status = "submit for approval"), but it just threw a blank, so I'm not sure where I am going wrong.

 

How can this be done? Thank you!

 

  • Hi Anonymous 

     

    What your current measure is doing is counting all the rows where each of those statements is true however the status cannot be all of them which is why you are getting a blank.

     

    Try replacing the commas with ||

     

    calculate(count(Table[ID]), status = "Assigned" || status = "New" || status = "Pending Change" || Status = "submit for approval")

     

    This is used instead of the OR function as the OR function only allows for 2 conditions. Alternatively, you could nest OR statements however the 2 pipe symbols is an easier approach for more than 2 or conditions.

     

    Hope this helps

     

    Thanks,

    George

1 Reply

  • judspud's avatar
    judspud
    Icon for Solution Supplier rankSolution Supplier

    Hi Anonymous 

     

    What your current measure is doing is counting all the rows where each of those statements is true however the status cannot be all of them which is why you are getting a blank.

     

    Try replacing the commas with ||

     

    calculate(count(Table[ID]), status = "Assigned" || status = "New" || status = "Pending Change" || Status = "submit for approval")

     

    This is used instead of the OR function as the OR function only allows for 2 conditions. Alternatively, you could nest OR statements however the 2 pipe symbols is an easier approach for more than 2 or conditions.

     

    Hope this helps

     

    Thanks,

    George