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 / Get Values from two dr...
Power Apps
Answered

Get Values from two dropdown Fields

(0) ShareShare
ReportReport
Posted on by 22

Hi All,

I would really appreciate any help because i really need to get this done. 

I have two dropdown fields in PowerApps each pulling from a SharePoint list(mileage_distance).  Both dropdowns store the same location and I want if a user selects a location in dropdown 1 and another location in dropdown 2, that a third field (text field) shows the distance between those two locations. The distance is also from the mileage_distance list

 

Please see attached milage_distance excel doc attached as well as a preview of my app.

Altontait_1-1626466121832.png

Thanks for your assistance,

Alton

 

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

    @Altontait What are the column names and data type of the From Location, To Location and Distance columns in the SP List.

     

  • Verified answer
    WarrenBelz Profile Picture
    156,940 Most Valuable Professional on at

    Hi @Altontait ,

    You cannot do index type queries in Power Apps as you cannot dynamically reference field names - you cannot specify a field name (other than hard-coding it) from a drop-down value (which I assume you manually coded for the top row.

    You would either need a table with two fields (place 1 and place 2) then specify each of the combinations of distances or hard-code the second drop-down results in the lookup 

    Switch(
     dd.Selected.xxxx,
     "CherryVille,
     Cherryville", 
     "Harwood",
     Harwood
     . . . . .
    

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Altontait Profile Picture
    22 on at

    Hi @CNT this is a preview of my SP List

    Altontait_0-1626469228257.png

     

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

    @Altontait So you are building a grid with n number of columns and n number of records in the SP List.

    The Items Property of the 2 Dropdowns could just be hard coded as columns and rows are fixed (I assume).

    Table({Location:"Board Office", "6 Mile",....})

     

    The Text property of the Textinput would be (change control names as required),

    Switch(dropdown1.Selected.Location,
    	"Board Office", LookUp(yourSPList, Title=dropdown2.Selected.Location).'Board Office',
    	"6 Mile", LookUp(yourSPList, Title=dropdown2.Selected.Location).'6 Mile',
    	.....
    	.....
    )

     

  • WarrenBelz Profile Picture
    156,940 Most Valuable Professional on at

    @Altontait ,

    As we have both advised, you will need to hard-code this in some form.

  • Altontait Profile Picture
    22 on at

    Hi @CNT @WarrenBelz,

    I would like to thank you guys for your assistance with this and I did manage to hard code it and it's working perfectly now. 

     

    Thank you guys again.

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

    @Altontait Glad to help!

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard