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 / label fill color on 2 ...
Power Apps
Answered

label fill color on 2 controls

(0) ShareShare
ReportReport
Posted on by 93

Hello everybody,

i have 1 small issue again, i want to use a statement on check of two  things 1) when its date yesterday and when a specify texfield is emty  then give a textlabel a red color  but i dont get it right

Somebody small help please 

thanks

I Try meany code but dont work

 

Switch(
 DateValue(Body1.Text);
 DateAdd(Today();-1);
 && If(IsBlank(UitgevoerdDoorLabel);
 (Label6);Color.Red; Color.Transparant
)

 

 

Categories:
I have the same question (0)
  • Prabhakar_S Profile Picture
    735 Moderator on at

    Hi @ginobelgium

     

    You can achieve this by using the If function for each condition and then combining the results using the And function. Here's the corrected formula:

     

    If(
     DateValue(Body1.Text) = DateAdd(Today(), -1) && IsBlank(DoorLabel.Text),
     Color.Red, // If both conditions are true, set color to Red
     Color.Green // Otherwise, set color to Green
    )

     

    In this formula:

    • DateValue(Body1.Text) = DateAdd(Today(), -1) checks if the date in the Body1.Text control was yesterday.
    • IsBlank(DoorLabel.Text) checks if the DoorLabel control's text is empty.
    • && is used to combine both conditions with the logical AND operator.

    If both conditions are true, the label's color is set to Color.Red. Otherwise, it's set to Color.Green.

    Make sure to replace Body1.Text and DoorLabel.Text with the actual names of your controls.

     

    Thanks!!!

     

    Please consider marking my response as the accepted solution if it successfully resolves your concern. If you found the information beneficial in other aspects, kindly express your appreciation by giving it a thumbs-up.

  • CU22100730-0 Profile Picture
    93 on at

    Thankyou verry much 

    Prabhakar_S it works great this way , 1 more small question: what do do if i want the iff statements become true if the date is between yesterday and yesterday -5
     

     

    If(
     DateValue(Body1.Text) = DateAdd(Today(), -1) && IsBlank(DoorLabel.Text),
     Color.Red, // If both conditions are true, set color to Red
     Color.Green // Otherwise, set color to Green
    )

     

    Thanks a lot
    PREVIEW
     
     
     
  • Verified answer
    Prabhakar_S Profile Picture
    735 Moderator on at

    Hi @ginobelgium ,

     

    You're Welcome. If you want the conditions to be true if the date is between yesterday and yesterday -5, you can modify the formula like this:

     

    If(
    DateValue(Body1.Text) >= DateAdd(Today(), -5) && DateValue(Body1.Text) <= DateAdd(Today(), -1) && IsBlank(DoorLabel.Text),
    Color.Red, // If all conditions are true, set color to Red
    Color.Green // Otherwise, set color to Green
    )

     

    Thanks!!!

     

    Please consider marking my response as the accepted solution if it successfully resolves your concern. If you found the information beneficial in other aspects, kindly express your appreciation by giving it a thumbs-up.

  • CU22100730-0 Profile Picture
    93 on at

    Goodmorning Prabhakar, i work it out last night and your help learn me a lot, thanks for your kindness!

    Only one thing, when i want with this code put text in a label, i try few codes in the TEXT part of the label  to fix this but not working great

    If(
     DateValue(Body1.Text) >= DateAdd(Today(), -5) && DateValue(Body1.Text) <= DateAdd(Today(), -1) && IsBlank(UitgevoerdDoorLabel.Text);
     (Label10);"Op te volgen";"")
    )

     

  • Verified answer
    Prabhakar_S Profile Picture
    735 Moderator on at

    Hi @ginobelgium ,

     

    Give this a try,

     

    If(
    DateValue(Body1.Text) >= DateAdd(Today(), -5) && DateValue(Body1.Text) <= DateAdd(Today(), -1) && IsBlank(DoorLabel.Text),
    "Op te volgen",
    ""
    )

     

    If you still have issues, send a screenshot of the error and give a quick brief on what you are trying to achieve.

     

    Thanks!!!

     

    Please consider marking my response as the accepted solution if it successfully resolves your concern. If you found the information beneficial in other aspects, kindly express your appreciation by giving it a thumbs-up.

  • Verified answer
    CU22100730-0 Profile Picture
    93 on at

    Thanks Prabhakar

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 379 Most Valuable Professional

#2
11manish Profile Picture

11manish 203 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard