Sharepoint list conditional formattin: highlight if two columns have different value

allyazz 131 Reputation points
2020-11-06T16:49:42.537+00:00

I have a list of payments, where one row has multiple payments (4). I have a calculated column, that sums these numbers, and another auto sum column, in which a flow sums the same 4 columns so that I have totals at the bottom of the list/grouped items (calculated column don't support totals). Because the calculated column is updated immediately and flow kicks in with a delay, I would like to have conditional formation set in place, that would highlight a value in the auto sum column, for as long as the flow doesn't update the number in that column. The difference is determined between the calc sum column and auto sum column and this is how I was planning to setup the conditional formating rule, but I can only set it to compare to a constant value, not variable from another column.

38046-screenshot-1.png

Any ideas?

Microsoft 365 and Office | SharePoint Server | For business
Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

Answer accepted by question author
  1. MichaelHan-MSFT 18,136 Reputation points
    2020-11-09T03:03:06.223+00:00

    Hi @allyazz ,

    You need to switch to Advanced mode to get values from other columns.

    38159-image.png

    Below is my Demo JSON code for your reference:

    {  
    "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",  
    "elmType": "div",  
    "txtContent": "@currentField",  
    "attributes": {  
    "class": "=if(@currentField != [$sum_x0020_calc],'sp-css-backgroundColor-blockingBackground50', '')"  
    }  
    }  
    

    Test result:

    38160-image.png

    Besides, the data type returned from the calculated column must be number type:

    38187-image.png


    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.

    1 person found this answer helpful.
    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. allyazz 131 Reputation points
    2020-11-09T20:27:58.767+00:00

    Hello @MichaelHan-MSFT ,

    thank you so much for your input. I tried copying it but if gave me error: Please enter valid column-formatting JSON. If I understand correctly I'm supposed to verify the name of the column only, right? Everything else is in the json code? I do have to say I have zero knowledge about json, I can copy and paste it but I don't know the syntax.

    I tried verifying it with online json verifyer and here's what it came up with:

    38424-screenshot-2.png

    What am I missing?


  2. allyazz 131 Reputation points
    2020-11-10T08:10:30.323+00:00

    Hi @MichaelHan-MSFT ,

    I did that but received an error, please see the screenshot:

    38550-screenshot-3.png


  3. allyazz 131 Reputation points
    2020-11-10T21:05:57.697+00:00

    You, sir @MichaelHan-MSFT are awesome! It works like a charm thank you so much! Could you perhaps recommend some resources for a json newbie?

    Thank you!


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.