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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
JamieLee
Frequent Visitor

Return value from other table with condition

Hi everyone, I would appreciate some help on this:

 

I have two tables that are linked through an OrderID. Let’s call the tables TableA and TableB.

TableA has unique OrderIDs. In TableB an OrderID can appear multiple times.

 

In TableA I want to add a calculated column with the name ‘Country’.

I can find the value for this new column in TableB[Keyword]. However TableB does not have unique OrderIDs and needs to be filtered on TableB[KeywordGroup] first. Only if the value in TableB[KeywordGroup] is “Country”, I want to return the value from TableB[Keyword].

 

So what I’m trying to achieve is this:

In the new column TableA[Country] I would like to return the value from TableB[Keyword] if TableB[KeywordGroup] = Country.

It’s probably very logical, but can’t find the right way of getting this done.

 

Hope you can help.

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @JamieLee

In table B, create a new table

Table = SUMMARIZE(FILTER(ALL(tableB),[KeywordGroup]="country"),[OrderID],[Keyword])

Then edit relationship between Table A and the new table

13.png

 

In table A, create a calculated column

Column = RELATED('Table'[Keyword])

14.png

 

Best Regards

Maggie

View solution in original post

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @JamieLee

In table B, create a new table

Table = SUMMARIZE(FILTER(ALL(tableB),[KeywordGroup]="country"),[OrderID],[Keyword])

Then edit relationship between Table A and the new table

13.png

 

In table A, create a calculated column

Column = RELATED('Table'[Keyword])

14.png

 

Best Regards

Maggie

This works. Thanks Maggie!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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