Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Shifting the Fill color based on the negating factor

(1) ShareShare
ReportReport
Posted on by

sabrinaaa__0-1719855723254.pngsabrinaaa__1-1719855770679.png

Hi I would like to shift a color (that is the circle) when the column in a same row's category has a value that is other than green into the following negating value (when  there is red it turns into red immediately) any suggestion for the expression?

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    146,702 Most Valuable Professional on at
    Re: Shifting the Fill color based on the negating factor

    Hi @sabrinaaa_ ,

    I am not sure if the logic is correct here due to your first condition which contradicts the next two, however you might have a look at this structure as it will save a lot of code and is easier to follow

    With(
     {
     _Colour:
     LookUp(
     'INVITE Project',
     ID = ThisItem.ID
     ).'Traffic Light',
     _Start:
     DateDiff(
     Today(),
     ThisItem.BaselineStart,
     TimeUnit.Days
     ),
     _End:
     DateDiff(
     Today(),
     ThisItem.BaselineEnd,
     TimeUnit.Days
     )
     },
     If(
     _Colour = "Green",
     Colour.Green,
     (_Colour = "Green" && _Start > 30) || (_Colour = "Green" && _End > 30),
     Color.Red,
     (_Colour = "Red" && _Start > 0 && _Start <= 30 || (_Colour = "Yellow” && _End > 0 && _End <= 30),
     Color.Yellow,
     Color.Green
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • sabrinaaa_ Profile Picture
    on at
    Re: Shifting the Fill color based on the negating factor

    It expected a boolean value instead of "Color.Green" any inputs?

  • Damin Profile Picture
    63 on at
    Re: Shifting the Fill color based on the negating factor

    I suggest for you to use Switch rather then If, in this scenario, Switch works better. In your code I think you are using extra brackets, for example before LookUp function you're using brackets, you don't need.

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,702 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,017 Most Valuable Professional

Leaderboard