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
Anonymous
Not applicable

Lookupvalue value error

Hello everyone, I was hoping you could help me out. I was trying to do a look up function, but I was getting an error because it has duplicate values. I figured I would try this Calculate but it didn’t return what I was looking for, can someone help me?

 

I wanted to take the value from 'FedEx Query'[Shipper Reference] and match it with the same number in 'DLX Report Query'[PALLET_ID] so that I could get the Dealer code value from 'DLX Report Query'[Dealer Code] which has duplicates, but it can just grab the first one.

 

I originally tried this and got an error for multiple values: Dealer Code/DLX = LOOKUPVALUE('DLX Report Query'[Dealer Code], 'DLX Report Query'[PALLET_ID], 'FedEx Query'[Shipper Reference])

 

Then I tried this and could get it to work: Dealer Code DLX 3 = CALCULATE(FIRSTNONBLANKVALUE('DLX Report Query'[Dealer Code],1),FILTER(ALL('DLX Report Query'), 'DLX Report Query'[PALLET_ID] ='FedEx Query'[Shipper Reference]))

Look up errorLook up errorCalculateCalculate

7 REPLIES 7
ryan_mayu
Super User
Super User

@Anonymous 

how do you define 'grab the first one'? by date?

i create a simple sample data for testing

1.PNG

try to create a column

Column = 
MAXX(FILTER(TableA,TableA[orderid]=TableB[orderid]&&'TableA'[date]=MINX(FILTER(TableA,TableA[orderid]=TableB[orderid]),'TableA'[date])),TableA[value])

2.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




nandic
Memorable Member
Memorable Member

@Anonymous ,
Try adding additional column in Table2:

Column = CALCULATE( FIRSTNONBLANK(Table2[Mark], Table2[Mark]), ALLEXCEPT(Table2, Table2[Id] ) )
-- Mark is value that i wanted to return in Table1, but there are different marks for same Id. 
-- So i added new column which returns always same Mark for same Id (first occurence)

Now when i return to Table1 where i want to add lookupvalue, i will not search by Table2[Mark], but by my new column which has unique values per Id.
Lookup formula: 
Lookup column = LOOKUPVALUE(Table2[Column],Table2[Id],Table1[Order Number])



Anonymous
Not applicable

DLX Report Table.png

FedEx Query Table.png

So I tried to do that and it didn't change any thing.

@Anonymous ,

I checked your screenshots.
Second image means that there is no unique value for parameters that you use in lookupvalue function. It means that you should add some more parameters which will return unique value.
First image, the logic is to return max value per some criteria. Currently your return value is [Dealer Code] and you are searching max dealer code per dealer code [allexcept(dealer code)]. So it will not find unique values.

So here are steps:
In first image, first parameter is min value that you want to return per specific criteria. And criteria should be inside AllExcept function (AllExcept means group by: so you will get some value per criteria1, criteria2, criteria3..).
In second image make sure to have as many lookup parameter as needed to make sure you have unique value to return.

Anonymous
Not applicable

You kinda lost me on that one. How do I need to write that to get it to work? I just want to get the dealer code to show up in the other table? 

 

 

Hi @Anonymous,

Can you please share some dummy data to test? It should help to test and trouble your code.

How to Get Your Question Answered Quickly 

Notice: remove sensitive data before share.
Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

I tried that and got too many arguments. So, here is what I am tryining to do, may there is a better way to do it.

 

In table FedEx Query I want to add a new column that will show a value. I need to use the Shipper Reference column to match the same value in column Pallet_ID in the table called DLX Report Query. That value I need to show in the new column in the table FedEx Query is called Dealer Code in the DLX Report Query. Sorry I am a little new at this, so it a bit confusing.

 

'FedEx Query'[Shipper Reference]    Need too use this number

'DLX Report Query'[PALLET_ID]       And Reference this number

'Report Query'[Dealer Code]         Need to show this column that has duplicates

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.