web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / LookUp function connec...
Power Apps
Answered

LookUp function connecting two data sets for each record

(0) ShareShare
ReportReport
Posted on by 117

Hello

 

I am building an app that uses 2 data sets, both are Excel Tables.

The first is called OrderTable, looks like  this

StockNumberControlNumberYieldCategoryDescriptionOnHandCutItem

07001

67001.95SeabassHybrid Bass  
0700567005.95TroutBoneless Charr  
0706167005.95TroutFrzn Charr  

 

The second is called InventoryTable, looks like this

StockNumberControlNumberDescriptionOnHand
0700167001Hybrid Bass100
0700567005Boneless Charr10
0700667006Haddock0

 

I had a vlookup formula in Excel that would match up records by ControlNumber, take the OnHand value from the InventoryTable, multiply that value by the Yield in the OrderTable, and populate the OnHand of the OrderTable with that resulting value. I did this because there could be many StockNumbers that match up to the same ControlNumber, and the ControlNumber is what dictates the OnHand inventory available to each stock number depending on their yield. 

  (Here's what that formula looked like)

  =((VLOOKUP(B3,'InventoryTable'!$B$2:$D$800,3,FALSE))*C3)

 

I am unable to use data sets with formulas in Power Apps so I tried recreating this functionality using the LookUp function. 

 

This is how my gallery is set up:

StockNumberDescriptionOnHand
7001Hybrid Bass95
7005Boneless Charr95
7061Frzn Charr95

The formula in the OnHand field is:

(ThisItem.Yield) * (LookUp(InventoryTable, ControlNumber in OrderTable.ControlNumber, OnHand))

 

The problem here is that the OnHand calculation is only using the inventory from the first record and pasting that into all records. The second and third record of this gallery table should be 9.5  (Yield = .95, OnHand = 10).

 

Is it possible to have each record calculate based on its own control number?

 

I'm sorry if this is hard to follow.

 

Thanks for your help!

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @BillKern 

    Try changing your formula to the following:

    ThisItem.Yield * LookUp(InventoryTable, ControlNumber = ThisItem.ControlNumber, OnHand)

    That should give you (if I understand your scenario) the results you want.

     

    I hope this is helpful for you.

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @BillKern ,

    Does your Gallery connect to the OrderTable in your canvas app?

     

    I assume that your Gallery is connected to your OrderTable in your canvas app, according to the formula that you mentioned, I think there is something wrong with it.

     

    I have made a test on my side, please consider modify the formula within the Text property of the OnHand Label in your Gallery to following (also agree with @RandyHayes solution almost):

     

    Value(ThisItem.Yield) * Value(LookUp(InventoryTable, ControlNumber = ThisItem.ControlNumber, OnHand))

     

    or

     

    Value(ThisItem.Yield) * LookUp(InventoryTable, ControlNumber = ThisItem.ControlNumber, Value(OnHand))

     

     

    Please consider take a try with above solution, check if the issue is solved.

     

    Best regards,

  • BillKern Profile Picture
    117 on at

    Perfect, thank you!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard