Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
lavdeepk
Resolver I
Resolver I

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
2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Picture1.png

 

Result CC : =
VAR _currentcustcode = Data[Cust Code]
VAR _filtertableproduct =
SUMMARIZE ( FILTER ( Data, Data[Cust Code] = _currentcustcode ), Data[Product] )
RETURN
IF ( 5 IN _filtertableproduct, "YES", "NO" )

 

https://www.dropbox.com/s/2o32swo7r1aidwu/lavdeepkv2.pbix?dl=0 

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

Migasuke
Memorable Member
Memorable Member

Hi @lavdeepk ,
You can try following solution:

Migasuke_0-1626936692459.png

 



If my answer was helpful please give me a Kudos or even accept as a Solution.

Let's connect on LinkedIn!

View solution in original post

4 REPLIES 4
Migasuke
Memorable Member
Memorable Member

Hi @lavdeepk ,
You can try following solution:

Migasuke_0-1626936692459.png

 



If my answer was helpful please give me a Kudos or even accept as a Solution.

Let's connect on LinkedIn!

Hi @Migasuke 

 

This is working fine

I appreciate your help so much

 

Arul
Super User
Super User

Hi @lavdeepk ,

 

Kindly check the below DAX formula.

 

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

Arul_0-1626936679128.png

 

 

 

Thanks,

-Arul

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


Jihwan_Kim
Super User
Super User

Picture1.png

 

Result CC : =
VAR _currentcustcode = Data[Cust Code]
VAR _filtertableproduct =
SUMMARIZE ( FILTER ( Data, Data[Cust Code] = _currentcustcode ), Data[Product] )
RETURN
IF ( 5 IN _filtertableproduct, "YES", "NO" )

 

https://www.dropbox.com/s/2o32swo7r1aidwu/lavdeepkv2.pbix?dl=0 

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors