Forum Discussion

Chris Cundy's avatar
Chris Cundy
Brass Contributor
Dec 02, 2019
Solved

Column formatting due date?

Hello, In the below example I am wanting to calculate a DueDate based on the "Priority" column. So for example if the Priority = "Low" then the Due Date would be "7 days" from "Created" date. When...
  • Norman Young's avatar
    Dec 04, 2019

    Hi Chris Cundy,

     

    You can you use a "Calculated" column to store the DueDate value based on the Priority column.

     

    Here is my sample code for the Calculated column calculation:

    =IF(Priority="Low",Created+7,IF(Priority="Medium",Created+14,IF(Priority="High",Created+21,Created)))

     

    Here is my sample JSON code for the column formatting:

    {
    "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
    "elmType": "div",
    "txtContent": "@currentField",
    "attributes": {
    "class": "=if([$DueDate] <= @now, 'ms-fontColor-themePrimary ms-fontWeight-bold', '')"
    }
    }

     

     

    I use the Examples of common formulas in SharePoint Lists site as a reference whenever I created Calculated columns.

     

    I hope this helps.

     

    Norm

Resources