Forum Discussion
Conditional formatting help
- Aug 19, 2022
carlblunck you've missed out the second =
It should be =='Under' etc
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "div", "txtContent": "@currentField", "style": { "color": "=if((@currentField > [$Benchmark] && [$Goal]) == 'Under', 'red', if((@currentField < [$Benchmark] && [$Goal]) == 'Over', 'red', 'green')", "font-weight": "=if((@currentField > [$Benchmark] && [$Goal]) == 'Under', 'bold', if((@currentField < [$Benchmark] && [$Goal]) == 'Over', 'bold', 'normal')" } }Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
ganeshsanap I'd already given the JSON code that works fine, even with the extra brackets. Be careful not to step on someone else's solution.
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
RobElliott Thank you for your response. Did you actually tried using the JSON you provided?
Try using the JSON you provided & let us know the results. Thank you.
- RobElliottAug 19, 2022Silver ContributorYes I did, as I always do, and it worked perfectly.
- ganeshsanapAug 19, 2022MVP
RobElliott Great, glad it worked for you!
And I am not trying to steal your solution. I replied to this thread only because I observed below problems with the JSON provided by OP in question. Thanks for your understanding, happy weekend!