Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

How to create a calculated column based on conditions

Hi All,

 

I am struggling to create a calculated column based on some conditions in Power Bi.  

Refer to the below sample data there are 4 products against a single Cust Code. My condition is if a Cust Code has this product "5"  then mark as "YES" else "NO " against Cust Code .(refer to desired results )

 

Please help me with the DAX formula to achieve desired results.

 

Cust CodeProductStatus desired results
A1NO
A2NO
A3NO
A4NO
B1YES
B2YES
B3YES
B5YES
C1NO
C2NO
C3NO
C4NO
D5YES
D2YES
D3YES
D4YES

4 Replies

  • Migasuke's avatar
    Migasuke
    Icon for Memorable Member rankMemorable Member

    Hi Anonymous ,
    You can try following solution:

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Migasuke 

       

      This is working fine

      I appreciate your help so much

       

  • Arul's avatar
    Arul
    Icon for Super User rankSuper User

    Hi Anonymous ,

     

    Kindly check the below DAX formula.

     

    Calculated column = IF(OR('Table'[Cust Code]="A",'Table'[Cust Code]="C"),"NO","YES")

     

     

     

    Thanks,

    -Arul