Forum Discussion
444456464
Feb 24, 2022Copper Contributor
Show % symbol
Hello,
I have a question. The columns I circled on my Sharepoint list are Number type columns and I checked the "percentage" box in the list settings.
I would like to be able to display the % symbol behind the numbers that are in my columns. Is it possible ?
Thank you in advance for your help !
- RobElliottSilver Contributor
444456464 yes it's possible with a bit of JSON column formatting:
The JSON is as follows and it's the txtContent line that's important here:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "div", "txtContent": "=toString(@currentField * 100) + '%'", "style": { "border": "none", "padding-left": "14px", "background-color": "=if(@currentField <= 0.1,'#468259', if(@currentField > 0.1 && @currentField <= 0.5,'#d8a810', '#c00000'))", "color": "white" } }
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)- 444456464Copper ContributorThank you ! But I have already this in my column formatting : {
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"color": "=if(@currentField >[$Tauxoccupationmaximal] , 'red', if(@currentField <[$Tauxoccupationmaximal], 'green' , 'orange')"
}
}- RobElliottSilver ContributorSo just change the txtContent to what I gave you and add in the background color if you need it, or don't add it if you dont.
- RobElliottSilver ContributorAs you will realise, the numbers need to be between 0.0 and 1.0.