Forum Discussion

sb2848's avatar
sb2848
Regular Visitor
3 years ago
Solved

Convert COUNTIF in Excel to DAX

Hi, I am relatively new to using DAX and was wondering if the below excel formula be converted into DAX? =IF(COUNTIF('County Player List'!A:A,[@County])>0,"Yes", "No")
  • v-yueyunzh-msft's avatar
    v-yueyunzh-msft
    3 years ago

    Hi, sb2848 

    Here are the steps you can refer to :
    (1)This is my test data:

    (2)We can click "New Column" to  create a calculated column :

    Flag = var _current_cou='County List'[Country] 
    var _count =COUNTROWS( FILTER('All Data 2021 & 2022','All Data 2021 & 2022'[County] = _current_cou ))
    return 
    IF(_count >0 ,"Yes" ,"No")

    (3)The result is as follows:

     

    If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

     

    Best Regards,

    Aniya Zhang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly