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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Unknown_1
Frequent Visitor

Need help on Lookupvalue dax

Hi Team,

 

I have a dataset of 3 columns a

1000213036.jpg

s stated in the picture attached.

I want to do a simple vlookup of the second column in the entire range and want to return the result(Third column) as a new column.

I tried using the simple Lookupvalue dax but was unsuccessful.

Please help me out!

Thank you!

1 ACCEPTED SOLUTION

Yes, blank rows will also cause that issue with LOOKUPVALUE.
You can try something like...

Calculated Column 2 = 
var _vTable =
SUMMARIZE(
    'Table',
    'Table'[Column1],
    "_value", SUM('Table'[Column3])
)
var _result =
SUMX(
    Filter(_vTable, [Column2] = [Column1]),
    [_value]
)
Return
_result

Let me know how that works.




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

Proud to be a Super User!





View solution in original post

6 REPLIES 6
jgeddes
Super User
Super User

That error is indicating that there are values in Column2 that appear more than once in Column1. If this is the case then LOOKUPVALUE will not work. You will need to decide how you are going to aggregate the data in Column3 and then use the appropriate function (SUM, AVERAGE etc.).




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

Proud to be a Super User!





I have cross checked the dataset there is only 1 matching value present in column 2 which is appearing in column 1. However there are a blank row. Is that causing the problem?

Also is there any other way in which I can solve this problem?

Yes, blank rows will also cause that issue with LOOKUPVALUE.
You can try something like...

Calculated Column 2 = 
var _vTable =
SUMMARIZE(
    'Table',
    'Table'[Column1],
    "_value", SUM('Table'[Column3])
)
var _result =
SUMX(
    Filter(_vTable, [Column2] = [Column1]),
    [_value]
)
Return
_result

Let me know how that works.




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

Proud to be a Super User!





Thanks it worked!

jgeddes
Super User
Super User

Using the example table...

Column1 Column2 Column3
AAA-BBB AAA-BBB 100
ABC-DEF ABC-FED 50
ABA-AAA ACA-AAA 75
DAC-FED DAC-FED 250

 

You can use a calculated column...

Calculated Column = 
LOOKUPVALUE('Table'[Column3],'Table'[Column1],[Column2])

 

To get the result...

jgeddes_0-1711630437589.png

 




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

Proud to be a Super User!





By doing this it's giving me the error " A table of multiple values was supplied where a single value was expected"

1000213097.jpg

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.