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 / Display different choi...
Power Apps
Answered

Display different choices IF value is x

(0) ShareShare
ReportReport
Posted on by 270

Hey

Little stuck with something.

I've got a SP list, with a choice column with 3 values "A" "B" "C" 

I have another choice field with 9 choices, "A1", "A2", "A3", "B1", "B2", "B3", "C1", "C2", "C3"
When "A" is selected I want only Values A1-A3 to appear in the other drop down (this works for me).

When I try to add more than one condition it doesn't work.

If(DataCardValue10.Selected.Value = "A", Choices([@List].Column), ["A1", "A2", "A3"]),
If(DataCardValue10.Selected.Value = "B", Choices([@List].Column), ["B1", "B2", "B3"])

 

I also need to cater for if "A" and "B" are selected, then I need to see both A choices and B choices, and if "A",  "B" and "C" are selected then by default show everything

Categories:
  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    This sort of filtering is tricky.   As soon as it finds a condition that matches, it stops, so you need to put your most complex conditions at the top of the list and go from complex to most simple in order.

    Since I can't see your entire formula, I have to presume that you have a default condition at the very end?

  • PowerAGuy Profile Picture
    270 on at

    @JR-BejeweledOne 
    Yes you right, but at the moment I cannot get the 2 different choices "A" and "B" to display only there own values A1 A2 A3 and B1, B2 and B3

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @PowerAGuy 

    Yes, to do this you simply need to filter.

    I am not clear if your second choice is an actual column in your SharePoint list or not as you seem to be directly placing the choices in your formula.

     

    If the Items for your second choices is hard-written into your formula, then the following formula:

    Filter(["A1", "A2", "A3", "B1", "B2", "B3", "C1", "C2", "C3"],
     StartsWith(Value, DataCardValue10.Selected.Value)
    )
    

    If it is a choice column from your SharePoint list then the following:

    Filter(Choices(yourList.yourColumn),
     StartsWith(Value, DataCardValue10.Selected.Value)
    )
    

     

    I hope this is helpful for you. 

  • PowerAGuy Profile Picture
    270 on at

    @RandyHayes 

    Thank you, you have lost me a little.

    To answer your question, all the values in both fields are choices in the the SP list.

     

    The startwith function, I can see working, but the values I have provided are of course not actual values
    But if i can use the contain function all the choice values contain a code number... is that possible?

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @PowerAGuy 

    Your example was pretty good, but it really highlighted the "StartsWith" concept.  

    What you are saying is that your choices are different than "startswith".

    Possibly something like - your choices in 2 are ["New", "Old", "Open", "Closed", "Happy", "Sad"] and you want what is selected in 1, which would have something like ["Age", "Status", "Emotion"] so that when you select, for example, "Emotion", you want #2 to show only "Happy" and "Sad".

    Something like that?

     

    If so, then what is the relation between 1 and 2?  Is there one?

  • PowerAGuy Profile Picture
    270 on at

    @RandyHayes 

    I don't think I have been clear (hopefully 2nd attempt is better).

     

    I have 3 values in a choice column "A - ABC", "B - EFG", "C - HIJ"

     

    The reference after the hyphen resides in all the choices for each of the selection in another choice field in SP.

     

    So when a user selects "A - ABC" I want the following to be available in another drop down: "A1 - ABC", "A2 - ABC", "A3 - ABC"

    If a user selects "B - EFG" I won't the following to be available in the drop down: "B1 - EFG", "B2 - EFG", "B3 - EFG"

    and the same for "C - HIJ"

    Struggling to get that working as shown in my code in first post, the code isn't right, but once we do get it working, I need to cater for the user selecting 2 of the 3 i.e. "A - ABC", "B - EFG" which should display both choice values, so 6 in total.

    Or a user selecting all 3 choices, "A1 - ABC", "A2 - ABC", "A3 - ABC" which should then display all the values for each choice.

     

    Have I explained a little better, sorry if not? 

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @PowerAGuy 

    Sort of...

    If I see the pattern there, it is still that you are concerned with the starting character of the first dropdown.  So, if 1 startswith "A", then all of the items in 2 should be the ones that start with "A" as well.

    OR, is it to say that if they choose A - ABC, then there might also be A1 - XYZ in your second and you ONLY want A1 - ABC.  Or in other words, the first character and the last 3 are important for the items in 2?

     

    While contemplating and clarifying the above for me, also, let me know that you are working with a Combobox or a Dropdown.  You mention that users might choose "A - ABC" and "B - EFG" simultaneously - this would only be something you can do with a multi-select combobox.

     

  • PowerAGuy Profile Picture
    270 on at

    @RandyHayes 

    I can change these choice values in drop down 1 to "ABC - A", "EFG - B", "HIJ - C"
    and the choices in dropdown 2 "ABC- A1", "ABC - A2", "ABC-A3" If it makes a difference? Having tried that and tried this code it presents me with 0 choices in dropdown 2: 

    Filter(Choices(List.Column), StartsWith(Value,DataCardValue10.Selected.Value))

    Both the fields are dropdowns, I have allowed multiple selection from SharePoint, I haven't created separate combo boxes and set there defaults to my SP column

  • PowerAGuy Profile Picture
    270 on at

    @RandyHayes 

    Furthermore, 

    I would say the 3 letters ABC, EFG, HIJ are the most important, they are what 'link' to the values chosen in the first dropdown 

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @PowerAGuy 

    I would only make changes to your format of the choices if it is appropriate and not impactful, and if it makes life easier!

     

    So, here is what I am getting from your scenario.  View the below animation and see if this is what you are looking for. 

    PowerAGuy.gif

     

    NOTE: The above is based on the last three letters of the selections in #1

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

#2
Mohsin Ali Profile Picture

Mohsin Ali 347

#3
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

Last 30 days Overall leaderboard