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 / Compare three values w...
Power Apps
Answered

Compare three values with values from columns

(0) ShareShare
ReportReport
Posted on by 46

Hi Power Comunity,

 

I'm working on a project where I need to find a result depending on 3 values. I'll try to explain it clearly. This should be a small app with one Excel table which contains 4 columns. Three of them are RSSi values and the 4th is "result" - the place where those three values have been measured. What I need is, to compare 3 values which will be written in 3 fields and find the most similar values in the table. As a result, there should be the value from 4th column, which has the closest values to those three from fields.

 

Has anyone an idea, or is this actually possible in PowerApps?

tdzevad_0-1663190419943.png

 

If I enter three values, e.g. -65, -82, -83, the system should check the database and as a result should return value GP46.

For any ideas, thanks in advance.

Sincerely, Jeff

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

    @tdzevad 

    Sure, given your data and your choice, you simply need to find the first of the lowest score of the difference between the values.

     

    This Sample formula will provide the concept:

    With({_data: 
     Table({AP1:-64, AP2: -81, AP3: -85, 'Real Position':"GP46"},
     {AP1:-56, AP2: -77, AP3: -86, 'Real Position':"GP45"},
     {AP1:-58, AP2: -72, AP3: -84, 'Real Position':"GP44"},
     {AP1:-68, AP2: -70, AP3: -82, 'Real Position':"GP43"}
     ),
     _choice: [-65, -82, -83]
     },
     First(
     Sort(
     ForAll(_data,
     {Score: Abs(AP1 - Index(_choice, 1).Value) + Abs(AP2 - Index(_choice, 2).Value) + Abs(AP3 - Index(_choice, 3).Value),
     'Real Position': 'Real Position'
     }
     ),
     Score, Ascending
     )
     )
    )
    

     

    This would return a record of {Score: 4, 'Real Position': GP46}

     

    I hope this is helpful for you.

  • tdzevad Profile Picture
    46 on at

    Hello Randy,

     

    Thanks for the answer and the solution. I was going to do it the same way, but do you know maybe how to avoid the problem when a "Real Position" has the same SUM with another that is far from that location?
    If I understood the concept, (sum all three values and find the closest one)?


    But that should work too, it's not so necessary to be so precise, so thanks for your answer and solution.

     

    Sincerely

    Jeff

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 324 Most Valuable Professional

#2
11manish Profile Picture

11manish 193

#3
Valantis Profile Picture

Valantis 138

Last 30 days Overall leaderboard