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
ExcelMonke
Resolver I
Resolver I

Lookup Value from different table workaround not working

Due to some cardinality issues I am trying to use lookupvalue/calculate firstnonblank as a workaround.

Background:
I have two tables:
TableA:

Column1: Unique ID values (PowerBI states there are multiple same values, although I check and these seem to all be unique and not duplicate. Nulls have been removed.)

Column2: Visit Type (RPV or NPV)

TableB:

Column1: Unique ID values (can be duplicate or blank)

 

For whatever reason, I can't seem to connect 'TableA'[Column1] with a One:Many relationship with 'TableB'[Column1].

 

My ultimate goal is to have TableB have values of TableA[Column2] linked correctly. I.e. each 'TableA'[Column2] value, should be matched up with the corresponding values in 'TableA'[Column1] and 'TableB'[Column1] respectively.

I have tried the Lookupvalue function and it produced an error. I next tried the following formula:


CALCULATE(
FIRSTNONBLANK('TableA'[Column2],1),
FILTER(ALL('TableA'), 'TableA'[Column1]='TableB'[Column1])
)

However I get wildly different results (Count of ID (Column1) in Table B and corresponding category):
Result:

NPVorRPV  Count of ID
RPV1702012
NPV437466
 56890
Total2196368

 

Intended Result (count of ID in Table A (Column1) and corresponding category):

NPVorRPV  Count of ID
RPV1599232
NPV364907
Total1964139


Any help is appreciated - thanks!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@ExcelMonke , Based on what I got

 

New column in Table 2

 

Minx(filter( 'TableA', 'TableA'[Column1]='TableB'[Column1]) , 'TableA'[Column2])

 

refer 4 ways (related, relatedtable, lookupvalue, sumx/minx/maxx with filter) to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@ExcelMonke , Based on what I got

 

New column in Table 2

 

Minx(filter( 'TableA', 'TableA'[Column1]='TableB'[Column1]) , 'TableA'[Column2])

 

refer 4 ways (related, relatedtable, lookupvalue, sumx/minx/maxx with filter) to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

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.