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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
shuhn1229
Resolver I
Resolver I

Combining First Non Blank with Filter

Hi all,

 

I have two tables, lets call them A and B. Table A is a key column and is used to map naming conventions to B when a user uses an inappropriate name. However, this mapping can be different depending on the ID column in table B. In essence I need to create a calculated column that Filters the ID of Table A by Table B, checks if the name column of the record is in table B, and if the Name in the given row is there, show the value in table A. If not, go with the value of name column in table B. Representation below with calculated column in the far right of table b:

 

table A

IDNameKey
ApplesQ732
ApplesQ743
OrangesR756
PineapplesQ731
PineapplesQ742
PineapplesQ753

 

Table B

IDNameValue
ApplesQ50Q50
ApplesQ51Q51
ApplesQ52Q52
ApplesQ732
ApplesQ743
PineapplesQ20Q20
PineapplesQ21Q21
PineapplesQ731
PineapplesQ742
PineapplesQ753

 

Thank you!

 

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

pls try this

 

 

Column = 

 COALESCE(
     CONVERT(
         CALCULATE(MAX('TableA'[Key]), FILTER(ALL(TableA),TableA[Name]='TableB'[Name]&&TableA[ID]='TableB'[D])),STRING),
     [Name])

 

 

Screenshot_3.pngScreenshot_2.png

View solution in original post

2 REPLIES 2
shuhn1229
Resolver I
Resolver I

seems to be working brilliantly. thank you for your help

Ahmedx
Super User
Super User

pls try this

 

 

Column = 

 COALESCE(
     CONVERT(
         CALCULATE(MAX('TableA'[Key]), FILTER(ALL(TableA),TableA[Name]='TableB'[Name]&&TableA[ID]='TableB'[D])),STRING),
     [Name])

 

 

Screenshot_3.pngScreenshot_2.png

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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