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 / Multiple if functions ...
Power Apps
Answered

Multiple if functions based on calculated field and selection

(0) ShareShare
ReportReport
Posted on by 48

Hi,

 

the situation is as follows. I have an edit form where I fill several fields and make a selection (6, 8, 10, 12, 16). Based on the entries and selection, value is calculated and presented in a label.

I want the label to change its color (indication that it meets the requirements) based on the calculated value and the selection: 6, 8, 10, 12, 16. The problem is that limit value (calculated based on the entries in edit form) for selections is different:

 

for 6 it is >0.5

for 8 it is >0.6

and etc.

 

Any ideas how to write the if functions for all the selections? Thanks.

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

    @Concrete 

    If your label is what is displaying the "0.5", "0.6" etc,  then you can put a formula on the Fill property of the label like this:

    With({labelValue:Value(Self.Text)},
    
     If(labelValue > .6, Red,
     labelValue > .5, Yellow,
     labelValue > .4, Green
     )
    )

    Note, you should do your higher leve4l comparisons in a descending order.

     

    I hope this is helpful for you. 

  • Concrete Profile Picture
    48 on at

    @RandyHayes 

     

    I want label to have only two colors: red - if it is lower than limit value (doesn't meet the requirements) and green - higher than limit value (meets the requirements). The thing is that the limit value for different selections 6, 8, 10, 12, 16 is different:

     

    for 6 it is >0.5

    for 8 it is >0.6

     

    How do I show in if function to first look into the selection (6, 8, 10, 12, 16) and then change color of label based on the comparison between calculated value and specific limit value?

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

    @Concrete 

    So the first question is Where is the 6, 8, 10, 12 etc. entered?  Is this in a TextInput control or a DropDown or ComboBox?  And what is the name of that Control?

     

  • Concrete Profile Picture
    48 on at

    @RandyHayes ,

     

    it is DropDown - DataCard1.

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

    @Concrete 

    Okay, so DataCard1 is not going to most likely be the name of the control.  If this is in an EditForm, then you will have a control in your DataCard1 - something like DataCardValuex

     

    That is what you will want to use in your Label Fill formula:

    With({labelValue:Value(Self.Text)},
    
     Switch(DataCardValuex.Selected.Value,
     6, If(labelValue > .5, Green, Red),
     8, If(labelValue > .6, Green, Red)
     )
    )

     

  • Concrete Profile Picture
    48 on at

    @RandyHayes ,

     

    When I post it to my Label Fill field I get an error. I have indicated DataCardValue11. Probably I don't understand something here.

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

    @Concrete 

    What is the DataCardValue11 control?  My understanding was that it was a DropDown.  What is the Items property of the control?

    Also, you mention you get an error...what is the error?

  • Concrete Profile Picture
    48 on at

    @RandyHayes 

     

    DataCardValue11 control is dropdown. Items property of it is - Choices([@'XXXX'].Diameter_x002c__x0020_mm)

     

    Error - Invalid argument type (Number). Expecting a text value instead.

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

    @Concrete 

    Yes, so then with choices, your values will all be text.  You need to convert.

    Try this formula instead:

    With({labelValue:Value(Self.Text)},
    
     Switch(Value(DataCardValuex.Selected.Value),
     6, If(labelValue > .5, Green, Red),
     8, If(labelValue > .6, Green, Red)
     )
    )

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

#2
Mohsin Ali Profile Picture

Mohsin Ali 356

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard