Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Simple Count with critreria

Hi Guru,

 

I would like to create a measure to count the below names that were never flagged as 'X', result should be 2.

 

 

NameFlag
John 
Sam 
Jess 
Adam 
AdamX
Adam 
SamX
  • Hi,

     

    you could create a measure that totals a distinct count of all names and calculates the number with an X then minus the names with x from the total:

     

    Measure =
    var Total = CALCULATE(DISTINCTCOUNT('Table'[Name]))
    Var NamesWithX = CALCULATE(DISTINCTCOUNT('Table'[Name]),'Table'[Flag]="X")
    return
    Total-NamesWithX
     
    If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

4 Replies

  • DOLEARY85's avatar
    DOLEARY85
    Resident Rockstar

    Hi,

     

    you could create a measure that totals a distinct count of all names and calculates the number with an X then minus the names with x from the total:

     

    Measure =
    var Total = CALCULATE(DISTINCTCOUNT('Table'[Name]))
    Var NamesWithX = CALCULATE(DISTINCTCOUNT('Table'[Name]),'Table'[Flag]="X")
    return
    Total-NamesWithX
     
    If I answered your question, please mark my post as solution, Appreciate your Kudos 👍
  • Anonymous Try this measure:

    Measure = CALCULATE(COUNT(CountTable[Name]),FILTER(CountTable,CountTable[Flag]="X"))

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    name and flag are seperate columns

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please feel free to let me know.

     

    Best regards,
    Community Support Team_Binbin Yu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.