Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
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:
The relationship is a 1:M
Can you please advise how to make it work?
Thanks.
Solved! Go to 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 ;). |
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. | Proud to be a Super User! |
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.
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 ;). |
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. | Proud to be a Super User! |
Hi @KNP
Look at the error after using related:
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 ;). |
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. | Proud to be a Super User! |
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 ;). |
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. | Proud to be a Super User! |
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 ;). |
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. | Proud to be a Super User! |
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 ;). |
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. | Proud to be a Super User! |
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 ;). |
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. | Proud to be a 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 ;). |
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. | Proud to be a Super User! |
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
113 | |
96 | |
92 | |
84 | |
69 |
User | Count |
---|---|
160 | |
125 | |
116 | |
110 | |
95 |