Formula for Conditional Choice in Column

Dan Chang 21 Reputation points
2022-03-03T00:13:35.023+00:00

I have a SharePoint list that has one column with States and another column with Cities.
Is it possible to have my Cities column only show the cities that are in the states I select from the States column?
For example:
States column has CA, CO, and GA as options.
Cities column has Los Angeles, San Francisco, Denver, Colorado Springs, Atlanta and Athens.
Is it possible to only have Los Angeles and San Francisco show up in the Cities column when I select CA from the States column?

Microsoft 365 and Office SharePoint For business Windows
0 comments No comments
{count} votes

Accepted answer
  1. JoyZ 18,111 Reputation points
    2022-03-03T10:03:13.747+00:00

    @Dan Chang ,

    Currently, we are unable to complete your request in a list with multiple columns.

    As a workaround, we need to prepare three lists to store related information then working with Cascading Lists in SharePoint and Power Apps.

    For detailed steps, please check as following:

    This example uses 3 different SharePoint lists:

    179616-image.png

    Cities: Contains a single line of text columns for the Title and Status. The list is populated with your cities with an associated status. The View used is grouping by Status.
    Status: Using the default Title field for the status title. The additional text field Cities is used as a placeholder for column formatting only.
    Cascading: The main list in this example, using Lookup fields for both cities and status(and cities:status) and a single line of text column for Title.

    Now we will customize the form for the Cascading list by opening Power Apps in a browser.

    In Power Apps, select the Cities:Status card and under the Advanced tab select "Unlock to change properties" to open up for edits,select the Items function value to make sure that the "Status" column is checked in the lookup field to the Cities list.

    Filter(Choices([@Cascading].'Cities: Status'), Value= DataCardValue2.Selected.Value)  
    

    179557-image.png

    Using the Filter function and the in operator we now can reference the values based in the Id from the Cities to show the proper Title value based on the selection of the Status.

    Filter(Choices([@Cascading].Cities), Id in Filter(Choices([@Cascading].'Cities: Status'), Value = DataCardValue2.Selected.Value).Id)  
    

    179615-image.png

    Save and publish the form, close the browser and open again, create a new list item to check the result:

    179596-333.gif

    More information for your reference:

    https://learn.microsoft.com/en-us/microsoft-365/community/working-with-cascading-lists-in-sharepoint-and-powerapps


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.