Forum Discussion

ExcelMonke's avatar
ExcelMonke
Icon for Impactful Individual rankImpactful Individual
2 years ago
Solved

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!