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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
yanivshe
Helper I
Helper I

Lookupvalue function returning BLANK

Hi all,

 

I am breaking my head over this one...

I have 2 table with products and their test results:

Table "PRODUCTS": contains products and metadata and test results

PRODUCT_LINE...TEST_RESULT
.........
IPHONE...97.87%
.........
CAMERA...93.25%
GPS...98.45%
GYRO...96.01%

 

Table "PRODUCT_TREE": contains product and it's product childrens.

PARENTCHILDQTY
.........
IPHONEGPS1
IPHONECAMERA2
IPHONEGYRO1
.........

 

So for example an IPHONE is composed of 1 GYRO, 1 GPS & 2 CAMERAS

The relationship between the tables is 1 to many on the PRODUCT_LINE & PARENT (1 product contains many parents) PRODUCT_LINE [1] <-> [*]PARENT (PRODUCTS table filters PRODUCT_TREE)

 

 

I need to get the TEST_RESULT of a CHILD in the PRODUCT_TREE table for later use.

On the PRODUCT_TREE table I added a new column called TEST_YIELD like so:

PARENTCHILDQTYTEST_YIELD
IPHONEGPS1=QTY*GPS_TEST_RESULT=1*98.45%
IPHONEGYRO1=QTY*GPS_TEST_RESULT=1*96.01%
IPHONECAMERA2=QTY*CAMERA_TEST_RESULT=2*93.25%

 

For the TEST_YIELD column I used the following column DAX:

TEST_YIELD =
var childYield = LOOKUPVALUE(PRODUCTS[TEST_RESULT], PRODUCTS[PRODUCT_LINE], PRODUCT_TREE[CHILD], 0.0)
return PRODUCT_TREE[QTY]*childYield

 

This return 0.

I dont know why I am getting 0?

Is it related to the relations between the tables?

Is it a bug in Power BI?

 

Did anyone encouterd such behavior?

Any idea how to resolve this?

 

Thanks in advance

 

 

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi  @yanivshe ,

 

Is there multiple rows have the same value in the column "Child"?If so,you'd better use relatedtable() instead of lookupvalue() and you need to create a calculated column as below:

 

 

Column = 
var a= CALCULATE(MAX('Table'[TEST_RESULT]),FILTER(RELATEDTABLE('Table'),'Table (2)'[CHILD]='Table'[PRODUCT_LINE]))
Return
'Table (2)'[QTY]*a

 

 

Finally,you will see:

Annotation 2020-02-24 125447.png

 

For the related .pbix file,pls click here.

 

 
Best Regards,
Kelly
 
Did I answer your question? Mark my post as a solution!

 

View solution in original post

4 REPLIES 4
v-kelly-msft
Community Support
Community Support

Hi  @yanivshe ,

 

Is there multiple rows have the same value in the column "Child"?If so,you'd better use relatedtable() instead of lookupvalue() and you need to create a calculated column as below:

 

 

Column = 
var a= CALCULATE(MAX('Table'[TEST_RESULT]),FILTER(RELATEDTABLE('Table'),'Table (2)'[CHILD]='Table'[PRODUCT_LINE]))
Return
'Table (2)'[QTY]*a

 

 

Finally,you will see:

Annotation 2020-02-24 125447.png

 

For the related .pbix file,pls click here.

 

 
Best Regards,
Kelly
 
Did I answer your question? Mark my post as a solution!

 

Greg_Deckler
Community Champion
Community Champion

You are getting zero because LOOKUPVALUE is returning the alternate value that you specified of zero. This is because LOOKUPVALUE cannot filter down to a single row. When multiple rows match the given criteria, LOOKKUPVALUE returns its alternate value, which by default is BLANK.

 

So, for whatever reason, you have multiple values being returned by LOOKUPVALUE. If you want to see what they are, do this:

 

TEST_YIELD_RESULTS =
  CONCATENATEX(
    FILTER(PRODUCTS,PRODUCTS[PRODUCT_LINE] = PRODUCT_TREE[CHILD]),
    [TEST_RESULT]
  )

 

Depending on your situation, you could use MAXX with the same filter used above in CONCATENATEX in place of LOOKUPVALUE or you could specify additional search criteria to ensure you get a single row returned.

 



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thanks, this worked for me on May 2023!

edhans
Super User
Super User

See my file here. Your calculated column seems to work for me as shown below, correct? It may be your relationship isn't set up correctly. See the model in my file and ensure yours is the same.

 

2020-02-23 07_42_21-20200223 - LOOKUP for Products - Power BI Desktop.png



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.