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
walker4545
Frequent Visitor

Calculated Column in DAX to check if values appear in another column, create an array from a table

Hello Power BI gurus, 

 

I need help with the following problem. I need to create a calculated column that evaluates whether a value appears in another column. 

 

Flag

Flag Colours
Red
White
Blue

 

Primary

Primary Colours
Red
Yellow
Blue

 

Primary Colour =
    VAR PrimaryArray = {"Red", "Blue", "Yellow"}
    VAR CheckPrimary = IF('Flag'[Flag Colours] IN PrimaryArray, "Primary Colour", "Not Primary Colour")
    RETURN CheckPrimary
 
The above code is a solution of how I would like the code to work (to calculate a column based on whether a value appears in an array). In the code above I'd like to replace the code in italics to bring in values from the column of another table. However, when attempting to declare the variable PrimaryArray against a column in the Primary Table I cannot access those values. 
 
How can I bring in the values from 'Primary'[Primary Colours] into an array that can be evaluated against to match values?
 
Thanks in advance!
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@walker4545 , Try like

 

Primary Colour =
VAR PrimaryArray = values(Primary[Primary Colours])
VAR CheckPrimary = IF('Flag'[Flag Colours] IN PrimaryArray, "Primary Colour", "Not Primary Colour")
RETURN CheckPrimary

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@walker4545 , Try like

 

Primary Colour =
VAR PrimaryArray = values(Primary[Primary Colours])
VAR CheckPrimary = IF('Flag'[Flag Colours] IN PrimaryArray, "Primary Colour", "Not Primary Colour")
RETURN CheckPrimary

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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
Top Kudoed Authors