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 / Blending Two Condition...
Power Apps
Unanswered

Blending Two Conditions in a Dropdown

(0) ShareShare
ReportReport
Posted on by 5,339 Moderator

Can someone one tell me how to blend the two following conditions into one?

 

No 1. returns all citis in the region of the city, because the member has a hierarchy of 'Region' (not related to the location region)

 

If(varProgramHierarchy="National", Sort(Distinct(Filter(Collection, Region = Dropdown1.Selected.Region),City), Result, Ascending))

 

and 

 

No 2. returns ALL cites, with the list defaulting to the users home city (required)

Sort(Filter(Collection, Title=varCityAlpha), Title, Ascending)

Categories:
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Phineas :

    Firstly,let me explain why you encountered this problem.

    The key is You cannot assign the item property setting of a control to two sources with different data structures at the same time.The data structures of the return values of your two formulas are inconsistent, which results in you not being able to merge these two formulas directly.

    The return value of 

     

    If(varProgramHierarchy="National", Sort(Distinct(Filter(Collection, Region = Dropdown1.Selected.Region),City), Result, Ascending))

     

    is a One-Column table something like:

    Result
    XX
    XX
    XX

    The return value of

     

    Sort(Filter(Collection, Title=varCityAlpha), Title, Ascending)

     

    's data structure is the same as the data source collection

    Title City XX XX
    XXXX XXX XX XX
    XXX XXX XX XX

    Secondly,If you only want to get a list of city,please try this formula:

     

    If(
     varProgramHierarchy="National", 
     Sort(
     Distinct(
     Filter(Collection, Region = Dropdown1.Selected.Region),
     City), 
     Result,
     Ascending),
     RenameColumns(ShowColumns(Sort(Filter(Collection, Title=varCityAlpha), Title, Ascending),"City"),"City","Result")
    )

     

    Best Regards,

    Bof

  • Phineas Profile Picture
    5,339 Moderator on at

    All of the first part worked.

     

    None of the second part worked.

     

    Errors:

    The function 'RenameColumns' has some invalid arguements

    The function 'ShowColumns' has some invalid arguements

     

    Current formula:

    If(varIsHierarchyRegion, Sort(Distinct(Filter(ParkListCollection, NPSRegion =Dropdown1.SelectedText.NPSRegion),Park), Result, Ascending). RenameColumns(ShowColumns(Sort(Filter(ParkCollection, Title=varParkAlpha), Title, Ascending), "Park"), "Park", Result))

     

    Why the quotation marks? I'm not looking for a specific Park just ALL, or Any associated with a region.

     

    Thank you,

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

    Hi @Phineas :

    If(
     varIsHierarchyRegion,
     Sort(
     Distinct(
     Filter(ParkListCollection, NPSRegion =Dropdown1.SelectedText.NPSRegion),
     Park
     ),
     Result,
     Ascending
     ),
     RenameColumns(
     ShowColumns(
     Sort(
     Filter(ParkCollection, Title=varParkAlpha), 
     Title,
     Ascending
     ),
     "Park"),
     "Park", 
     "Result"
     )
    )

    Best Regards,

    Bof

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 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard