JSON Date - 2 Fields

Portland 21 Reputation points

Need a little help please. I have 2 SharePoint date type columns in my list. "Due Date" | "Completed Date"

I am looking to set the color in the Completed Date column.

If the Completed Date is before the Due Date, display completed date as green.

If Completed date is after Due Date, display as red.

If completed date equals due date, display as default black text.

A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,875 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jerry Xu-MSFT 7,931 Reputation points

    Hi, @Portland ,

    Please try the JSON below. Make sure the field name matches the columns in your list.

      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",  
      "elmType": "div",  
      "txtContent": "@currentField",  
      "style": {  
        "color": "=if(@currentField<[$DueDate],'Green',if(@currentField>[$DueDate],'Red','') )"  


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful