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 / How do I change the va...
Power Apps
Answered

How do I change the value of a component according to what is selected in Dropdown?

(0) ShareShare
ReportReport
Posted on by 55

I would like to know how to change the value of a "Text" component according to what is selected in an input Dropdown.

In the table I'm using, every month has its generated value and its target value. What I need is that when I use the Dropdown and select for example the month of January, it brings me in a component "Text" the target value ("80%") and in another component "Text" it brings me the value produced that month ("90%"). I would also like that when the value produced was below that month's target, the text would be red, and when it was above, the text would be green. As in the following examples:

 

These are the amounts I should receive when selecting the month of January from the dropdown above. (Note that as the "Value" was above the "Target" it turned green, if it was below it should have turned red.)These are the amounts I should receive when selecting the month of January from the dropdown above. (Note that as the "Value" was above the "Target" it turned green, if it was below it should have turned red.)

 

 Note that in the table each month has a specific target value.Note that in the table each month has a specific target value.

Categories:
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Alex_Alcolea 

    Kind of depends on the Items property of your dropdown.

    If your dropdown Items are based on your table, then you simply can set the label text properties to:

    yourDropdown.Selected.'Target %'   and the other to  yourDropdown.Selected.'Value %'

     

    If that does not work, then provide what your dropdown items property is.

     

    I hope this is helpful for you.

  • Alex_Alcolea Profile Picture
    55 on at

    Worked perfectly. Thank you very much! Would you also know how to tell me how to change the text color of the "Value" if it is below your specific month? For example: The "Value" for the month of April was below the "Target" value so I would like to change its color property to red. It is possible? 

     

           In the case of April the value of the "Target" is 87%, as the value generated was 86% it was below, I would like that whenever the value was below, the text would be in red.In the case of April the value of the "Target" is 87%, as the value generated was 86% it was below, I would like that whenever the value was below, the text would be in red.

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

    @Alex_Alcolea 

    Sure, change the color property of the label for the value to:

    With({_val: IfError(Value(Self.Text), 0),
     _target: IfError(Value(yourTargetLabel.Text), 0) },
    
     If(_val < _target , Red, Green)
    )

    In the above, I am separating out the value and the target in the with variable only for clarity in the formula.

  • Alex_Alcolea Profile Picture
    55 on at

    It worked perfectly, thanks so much for the 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