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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
o59393
Post Prodigy
Post Prodigy

Lookupvalue not working between 2 tables

Hi all

 

I am doing a lookup calcualted column, but doesn't work

 

Basically I have a table called 'Master Plant & Product' that has to xlooup its values on another table called 'SKU by line - Official'.

 

The IF statement I use is very simple:

 

IF value in column Merged Plant & Product of 'Master Plant & Product' table is found in column Merged Plant & Product of 'SKU by line - Official' table, then return an "Exists" else "Doesn't exist".

 

The example above is explained in this excel: https://1drv.ms/x/s!ApgeWwGTKtFdh2c9PC00KsBrHMrF?e=AMkZgI

 

I am trying to replicate that with a lookupvalue but gives me an error:

 

o59393_0-1633564841037.png

 

 

 

The relationship is a 1:M

 

o59393_1-1633564886101.png

 

 

Can you please advise how to make it work?

 

Thanks.

1 ACCEPTED SOLUTION

Try this instead...

IF('Master Plant & Product'[Merged Plant & Product] IN DISTINCT('SKU by line - Official'[Merged Plant & Product]), 1,0)

 

I may have typo'd your column names so double check those.

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

View solution in original post

11 REPLIES 11
o59393
Post Prodigy
Post Prodigy

Hi @KNP 

 

The purpose is to have an alert system when user misses adding the correct data. Long story short I summarized it in that excel to not include all the model and sensible data.

 

Can we have it in dax calculated column? 

Thanks !!

I think the RELATED function would be more useful given you already have a relationship setup.

Checkout this link.

https://stackoverflow.com/questions/67783229/check-if-value-is-in-another-table-and-add-columns-in-p... 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

Hi @KNP 

 

Look at the error after using related:

o59393_1-1633571949628.png

 

 

 

Strangely I do have a relationship.

 

Any idea?

 

Thanks.

Try this instead...

IF('Master Plant & Product'[Merged Plant & Product] IN DISTINCT('SKU by line - Official'[Merged Plant & Product]), 1,0)

 

I may have typo'd your column names so double check those.

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

Wow @KNP 

 

It worked! so the distinct in your dax basically converted the duplicated values to unique ones correct?

 

Thank you so much 🙂

It just gets the unique values of that column from the SKU table to compare with the Master table. So not to compare every row. 

At least, that's how I understand it to work.

 

Glad I could help, especially since my DAX knowledge is a work in progress. 😁

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

Thank you so much @KNP 

 

I guess the duplicate values on the SKU table were making noise and couldn't return the value.

 

Thanks!

Just did some testing/reading.

Looks like the RELATED (at least in this scenario) only works on the table on the 'many' side of the relationship. So in your case, the column would need to be added to the SKU table I believe.

 

There will be a better way. Going to do some more investigation.

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

Can you double check the column name in the SKU table?

It isn't recognising it for some reason.

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

If you need a DAX solution I'll leave it for someone better versed in DAX.

If you wanted Power Query I'd simply merge with appropiate joins to only keep existing/non-existing.

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x
KNP
Super User
Super User

As far as the report is concerned, what is the purpose of the 'Product Exists' column?

Would you be happy for a Power Query solution or does it need to be DAX?

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

Helpful resources

Announcements
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!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.