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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Finding a value based ...
Power Apps
Unanswered

Finding a value based on a comparison of two collections

(0) ShareShare
ReportReport
Posted on by 40

Hello, 

I have two collections, which I want to compare to get a certain value based on a variable. 

Let me sketch te situation. I have a collection like this, where there a different models that determine the worth of something based on the months the product is old. 

Collection name: "Value"

Name:Month1: Month2: Month3Month4: Month5: 
ModelX75%70%65%60%55% 
ModelY70%60%50%40%30%

 

The second collection has a row with name, a selected model from the collection above., a starting price and the age in months. Based on that I want to calculate te current prize. 

Collection name: "Products"

Name: Model: starting Price Age (in months) Current price 
ProductXModelX€100,-2?
ProductYModelY€50,-3?

For example ProductX was €100 at the start but because it's 2 months old it should only have 70% left off the starting price. So €70,-. ProductY should take modelY to get the current price to 50%, which would be €25,- left. 

 

So basically I'm looking for a way to get the right percentage based on the selected model and age in months from another collection. And then use it to calculate the current prize based on the start price and the right percentage.

Can someone help me figure this out?

Thanks in advance!

Categories:
I have the same question (0)
  • Project2021 Profile Picture
    40 on at

    I'm very close to the solution I think. I have made

    LookUp(Value; Name = ThisItem.Name;Month1)

    Now I have the value for the first month in my gallery.

     

    I only need to make Month1 in the code based on the "age" of the collection "Products". 

     

     

  • Verified answer
    rizkyaditya Profile Picture
    292 on at

    Hello @Project2021 ,

     

    You can try this to select which Month column value you want to return based on Age :

     

    Switch(Age,
     1, LookUp(Value, Name = ThisItem.Name, Month1),
     2, LookUp(Value, Name = ThisItem.Name, Month2),
     3, LookUp(Value, Name = ThisItem.Name, Month3),
     4, LookUp(Value, Name = ThisItem.Name, Month4),
     5, LookUp(Value, Name = ThisItem.Name, Month5))

     

     

    Oh and if you use in the formula instead of using this ,

    please change it to suit your format

    I hope this helps!

  • Project2021 Profile Picture
    40 on at

    Thanks! This was exactly what I was looking for!

  • Verified answer
    CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Project2021 This way yo can have any number of months,

    CNT_0-1621588922962.png

    Formula for calculating the Current Price

     

    "Current Price:" & LookUp(colValuePercent, Model=ThisItem.Model && MonthNumbner=ThisItem.Age).ValuePercent/100 * ThisItem.StartingPrice

     

  • Project2021 Profile Picture
    40 on at

    Thanks a bunch! with the help off you two I solved my problem! 

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Project2021 Glad to help!

     

    Please remember to give a 👍 and accept the solution as it will help others in the future.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard