Forum Discussion

Brad333's avatar
Brad333
New Member
3 years ago
Solved

CountIf with multiple filters

Hi,   Im trying to create a countif in DAX with multiple criteria below is an example, it works when I have the first section but the minute I add the && is shows zero results, im guessing im way o...
  • Mikelytics's avatar
    3 years ago

    Hi Brad333 

     

    The Problem is that you use an AND condition. What you are doing is you filter a table by checking whether a line has in column [app_phase] the values 

    complete" AND

    "almost complete" AND

    "delayed" AND

    "restarted"

     

    But since each line can in a column only have one value your if-check everytime returns FALSE which ends in an empty table. I am pretty sure that you need to use || instead of && because || is an OR condition. This means for each line itr will be checked in column [app_phase] has one of the four values and not all together.

     

    So please try:

    AppTest = CALCULATE(COUNT('app'[app_phase]),
    FILTER(ALL('app'), [app_phase] = "complete"
    || [app_phase] = "almost complete"
    || [app_phase] = "delayed"
    || [app_phase] = "restarted"))

     

    Best regards
    Michael
    -----------------------------------------------------
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Appreciate your thumbs up!
    @ me in replies or I'll lose your thread.