Forum Discussion
HELP IN LOOKUPVALUE
- 4 years ago
Hi wadda7 - you can use LOOKUPVALUE(), but I suggest the below is faster.
Category = MAXX( RELATEDTABLE('Inventory Transactions'), 'Inventory Transactions'[category] )MAXX (or MAX) simply convert a table of the same value to one scalar value, so think of it like FIRST.
However, LOOKUPVALUE is this:Category 2 = LOOKUPVALUE( 'Inventory Transactions'[category], 'Inventory Transactions'[itemid], 'All Items'[itemid] )My PBIX is here if you want to review.
Hello - this worked just fine for me. I have attached the pbix. If this didn't work for you, check the values in the itemid columns of both tables to ensure they really are the same. It looks like your numbers are formatted as text, so the values may need to be trimmed/cleaned to remove trailing spaces or other whitespace characters. That can easily be done in Power Query by selecting the column(s) > right-click > transform > clean/trim.
CATEGORY = lookupvalue ( inventtrans[category], inventtrans[itemid], allitems[itemid] )
Hello jennratten
Yes the itemid column is text type because ite has numbers and text like this
itemid
0965-22345ss
I did the trim and clean and I got this error
in allitems table the itemid is uniqe but in the inventtrans table the itemid can comes more than one time
- jennratten4 years agoSuper User
Did you trim and clean the columns in both tables?
- jennratten4 years agoSuper User
Try taking a look at the pbix that I attached in the reply on Saturday. That had the working sample.