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 does not return all values

Hello to all

 

This is in fact a strange one (or not):

I'm using LOOKUPVALUE with the following data (ITEM):

ID  TID  Previous Status
1   2       A

2   2       B

3   2       C

4   3       A

5   3       B

6   4       A

7   4       B

 

And this one (GROUP):

Status   Group
A          Group1

B          Group1

C          Group2

 

So using this

LOOKUPVALUE(GROUP[group],GROUP[Status],ITEM[Previous Status])

 

I'm getting only value in the first TID...

ID  TID  Previous Status  LOOKUP
1   2       A                         Group1

2   2       B

3   2       C

4   3       A                        Group1

5   3       B

6   4       A                        Group1

7   4       B

 

I have a relation beetween tables in another column.

 

Why is this happening?

 

Thanks

 

 

 

 

10 REPLIES 10
Anna_O
Frequent Visitor

Did you find a solution to this? I have the same issue where I know for a fact that there are values to be found, yet LOOKUPVALUE randonly returns blank values in some rows.

v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

"I have a relation beetween tables in another column."

I tested such a scenario where there existing a relationship based on another column, but the results returned by LOOKUPVALUE looked as expected.

 

Please show us how did you establish this relationship. Please provide some more detailed repro steps.

 

Regards,

Yuliana Gu

 

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

I believe this is by design:

 

https://docs.microsoft.com/en-us/dax/lookupvalue-function-dax

 

Return value

The value of result_column at the row where all pairs of search_column and search_value have a match.

If there is no match that satisfies all the search values, a BLANK is returned. In other words, the function will not return a lookup value if only some of the criteria match.

If multiple rows match the search values and in all cases result_column values are identical then that value is returned. However, if result_column returns different values an error is returned.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thanks @Greg_Deckler

I also red that.. but for me the values are in fact diferent... I assumed that the behaviour was not the one you describe.

 

So..

 

A Filter/Calculate to get this one?

Are the 2 tables related? Seems like if you relate them ITEM[Previous Value] > GROUP[Status] that this problem becomes trivial. Or are these 2 tables already related some other way?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler they are related in other field.

 

So I think I can not use what you refer.

 

 

 

 

Even more perplexing, I implemented your formula as a Column in ITEM table and it worked perfectly, got all of the group names. This was with completely unrelated tables. So, I'm guessing that you do in fact have a relationship between the tables and that is what is messing with your formula.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Yep... bu I tried the same with a "new" table that withou relation and the result was the same...

 

I attached my file, tables 34 and 35. I'd have to understand how the tables are related to probably tell you how to solve it.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thank @Greg_Deckler

After seeing your reply I went again trough all the data and for some weird reason the duplicate table had no data...

 

After doing it by hand.. it worked. But without relation between tables. I would say that we have a bug in the lookup function.

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.