Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Count with Conditions & Filter

I am trying to count the number of Records whose status reason is either accepted, rejected or cancelled and I am not getting the right number using this measure

 

Total Resolved = CALCULATE(DISTINCTCOUNT('table'[ID]), FILTER('table', table[Status Reason]<>"Accepted" && table[Status Reason]<>"Rejected" && table[Status Reason]<>"Cancelled"))
 
your help is most appreciated

 

IDStatus ReasonState
DRQ-001AcceptedActive
DRQ-002ReviewingActive
DRQ-003Awaiting ReviewActive
DRQ-004RejectedInactive
DRQ-005CancelledInactive
DRQ-006AcceptedActive
DRQ-007ReviewingActive
DRQ-008Awaiting ReviewActive
DRQ-009RejectedInactive
DRQ-010CancelledInactive
DRQ-011AcceptedInactive
DRQ-012ReviewingActive
DRQ-013Awaiting ReviewActive
DRQ-014RejectedActive
DRQ-015CancelledInactive
DRQ-016AcceptedInactive
  • It is little confusing, your post says as "... status reason is either accepted..." and your DAX syntax uses <>. Taking your DAX and providing below. If you are looking for one of these status reasons, then remove the word "not".

     

    Total Resolved = CALCULATE(DISTINCTCOUNT('Table'[ID]), FILTER('Table', not 'Table'[Status Reason] in { "Accepted", "Rejected", "Cancelled"}))

     

    Output:

     

     

1 Reply

  • It is little confusing, your post says as "... status reason is either accepted..." and your DAX syntax uses <>. Taking your DAX and providing below. If you are looking for one of these status reasons, then remove the word "not".

     

    Total Resolved = CALCULATE(DISTINCTCOUNT('Table'[ID]), FILTER('Table', not 'Table'[Status Reason] in { "Accepted", "Rejected", "Cancelled"}))

     

    Output: