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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Bpark1994
Helper I
Helper I

Need Help With Dax! Calculated Column 1 to many. If text contains..

Hi,

 

Say i have 2 tables joined with a 1 to many relationship.

 

TableA

 

ID

1

2

3

 

TableB

 

ID | Status

1 | Rejected

1 | Approved

2 | Pending

2 | Invoiced

3 | Sent

3 | Pending

3 | Invoiced

 

I want to add a calculated column to TableA that checks to see if any of the corresponding IDs are invoiced and if so put a yes, if not put a no.

 

End result should look like the following

 

TableA

 

ID | Contains Invoiced?

1 | No

2 | Yes

3 | Yes

 

Thanks for any help!

 

1 ACCEPTED SOLUTION

@Bpark1994

 

Try this one

 

Column =
CONTAINS ( RelatedTable(TableB), [Status], "Invoiced" )

Regards
Zubair

Please try my custom visuals

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

This may not be the best approach - but I would create a new calculated column on Table B of "isInvoiced" where the dax would look something like this - IF(Status="Invoiced","Yes","No") - then do a calcualted measure "Contains Invoiced" which is the MAX(isInvoiced) of this new column - "Yes" is above "No" in text,  so then row context should kick in on putting ID with this new Calculated Measure and show Yes if there is an Invoiced on it, and No if there is not.

Hi st3vemartin,

 

Unfortuanently when i do that and add the measure as a calculated column into TableA every row is just populated with "Yes" whether it is suppose to be or not.

@Bpark1994

 

Try this one

 

Column =
CONTAINS ( RelatedTable(TableB), [Status], "Invoiced" )

Regards
Zubair

Please try my custom visuals

You're my hero

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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