web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Function of If stateme...
Power Apps
Unanswered

Function of If statement for dropdown based on the previous dropdown selection

(0) ShareShare
ReportReport
Posted on by 4
Hi Community!
 
I have to build two dropdown of which if the first dropdown is "A" then the second dropdown will set as "E"
 
The list of the first drop down:
A
B
C
D
 
The second dropdown based on selection :
A = E
B = F
C = G
D = H
 
How do we do this? and where to set it?
Categories:
I have the same question (0)
  • Suggested answer
    Nandit Profile Picture
    1,568 Moderator on at
    Function of If statement for dropdown based on the previous dropdown selection
     
    To achieve this, you can make use of the Switch statement in the DefaultSelectedItems property of the second dropdown. 
     
    Items property of the First Dropdown:
    ["A", "B", "C", "D"]
    Items property of the second Dropdown:
    ["E", "F", "G", "H"]
     
    Here is the DefaultSelectedItems property of the Second Dropdown:
    Switch(
        firstdrpdown.Selected.Value,
        "A",
        ["E"],
        "B",
        ["F"],
        "C",
        ["G"],
        "D",
        ["H"]
    )
    Here's how it looks:
     
    Hope this helps. 
     
    Kind regards, 
    Nandit

    If this answers your query, please mark this response as the answer.
    If its helpful, please leave a like. Thanks!
  • NH-09100837-0 Profile Picture
    4 on at
    Function of If statement for dropdown based on the previous dropdown selection
    Hi @nandit,
     
    It throw me an error. I might look noob here but may I know where do you put the switch statement? I dont find DefaultSelectedItems property. 
     
  • Suggested answer
    Ravindra Jadhav Profile Picture
    342 Moderator on at
    Function of If statement for dropdown based on the previous dropdown selection

    using the Switch function in Power Fx, We Can Achive this

    1. Set the Items property of the second dropdown based on the first dropdown selection:

    In the OnChange property of the first dropdown (let’s call it Dropdown1):

    Switch(
    Dropdown1.Selected.Value,
    "A", "E",
    "B", "F",
    "C", "G",
    "D", "H",
    ""
    )
    
    Set the Items property of the second dropdown (let’s call it Dropdown2) to this formula:
    
    Table({Value: Switch(Dropdown1.Selected.Value, "A", "E", "B", "F", "C", "G", "D", "H")})
     
    Please Closed the Question, Mark it Solved 
     
    If my answer helped resolve your issue, please consider marking it as solved to assist others facing the same problem. Additionally, giving it a like would be greatly appreciated and motivates us to keep helping
     
    Thank You
    Ravindra Jadhav

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 836 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 231 Super User 2025 Season 2

Last 30 days Overall leaderboard