Need help conditional formatting a date column!

Copper Contributor

Hi,

 

So i've had a look through previous threads & not managed to find the answer.

I'm trying to get it so anything @now- 2years turns the cell background red, but anything less than 2 years ago turns it green.

This is what i have so far - turns the +2yrs red, but everything else is just a different shade of red...

Any help greatly appreciated!

Thank you!!

 

{
  "elmType": "div",
  "txtContent": "@currentField",
  "style": {
    "background-color": "=if(@currentField >= @now + 2592000000 || @currentField <= @now - 62208000000,'red', '#ffa59b')"
  }
}

 

 

2 Replies

@FVaughan  there should be a minus - instead of a plus + in that first part of the condition: 

=if(@currentField >= @now + 2592000000

as you've got it at the moment it's looking at some date in the future!

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

Hi @RobElliott 

Thanks for that!! Silly me! I;ve altered it, but it doesn't seem to have changed anything.

I still have some dates in deep red & the rest in light red...

Any idea on how to make the ones that are 2 years overdue to me deep red, but everything less than 2 yrs green?

 

Thank you!