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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jasonyeung87
Helper V
Helper V

Create column in Dax containing value of related table

Hi,

I have a couple of tables named Product and Colour and they are related by the Product ID:

Product:

Product table.JPG

 

Colour:

Colur table.JPG

 

A product would have 0 or 1 active colour and 0 or more inactive ones. have imported these tables in Power BI and want to create a new column using DAX that displays the Active colour (or "None" if the product has no active colours):

combinede.JPG

I was wondering if there's a DAX expression I could use for this column? 

 

Jason

 

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @jasonyeung87 ,

 

You could create a calculated column as follows.

Color =
VAR _COLOR =
    CALCULATE (
        MAX ( 'Colour'[Colour] ),
        FILTER ( 'Colour', [Product ID] = 'Product'[Product ID] && [Status] = "Active" )
    )
RETURN
    IF ( ISBLANK ( _COLOR ), "None", _COLOR )

vstephenmsft_0-1653458658932.png

 

You can check more details from my attachment.

 

Best Regards,

Stephen Tao

 

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @jasonyeung87 ,

 

You could create a calculated column as follows.

Color =
VAR _COLOR =
    CALCULATE (
        MAX ( 'Colour'[Colour] ),
        FILTER ( 'Colour', [Product ID] = 'Product'[Product ID] && [Status] = "Active" )
    )
RETURN
    IF ( ISBLANK ( _COLOR ), "None", _COLOR )

vstephenmsft_0-1653458658932.png

 

You can check more details from my attachment.

 

Best Regards,

Stephen Tao

 

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

lbendlin
Super User
Super User

You would use COALESCE() for that.

 

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to assist you. Avoid posting screenshots of your source data if possible.

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.