Forum Discussion
sharepoint formatting
blueflame2130 add a calculated column called KPI with the following formula that compares the BoilerDue and BoilerInspection columns:
=If([BoilerInspection] > [BoilerDue], "Fail","Pass")
Then format the KPI column with the following JSON (advanced mode):
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"padding-left": "14px",
"background-color": "=if(@currentField =='Fail', '#c00000','teal')",
"color": "white"
}
}
The result is as follows:
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
RobElliott many thanks for that I really appreciate it . Can I ask would it still work if I put dates in the description or not ? just I cant seem to get it to work if I use BoilerDue2022 and BoilerInspection2022 and KPI2022
Many Thanks
- RobElliottApr 26, 2022Silver Contributor
blueflame2130 yes it will still work, they are just text column names. But always check the internal name of a column, particularly if you change it! Go to list settings, edit the column and in the url at the top the internal name is after field=
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)- blueflame2130Apr 27, 2022Copper ContributorMany thanks Rob I've managed to get that working now you have saved my head from exploding lol , just need to try and get the advanced bit for the colour to work now for some reason it wont let me save the code