1

I have a list where we track an employees performance by awarding badges. When 4 badges are earned, the employee achieves a Pennant. I have a calculated column for Progress that adjusts by 25% with each badge earned, and is also formatted to displays color coded bars.

Calculated Progress field JSON:

=IF(Achievement4>0,"1.00",IF(Achievement3>0,".75",IF(Achievement2>0,".50",IF(Achievement1>0,".25",))))

I can't get the Pennant image to display. I don't get an error with my JSON, but the field is blank. I want the Pennant column to display the pennant image when the Progress reaches 100%.

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "img",
  "style": {
    "width": "100px"
  },
  "attributes": {
    "src": "=if([$Progress]='1.00', 'https://contoso.sharepoint.com/sites/HR/SiteAssets/Servicers.png', ''))"

  }
}

Any idea what I'm doing wrong and/or why my Pennant isn't displaying when the Progress field reaches 100%?

0

1 Answer 1

0

Try this:

Use calculated column formula and settings like this:

=IF([Achievement4]>0,1,IF([Achievement3]>0,0.75,IF([Achievement2]>0,0.50,IF([Achievement1]>0,0.25,""))))

enter image description here

Then use JSON column formatting like below to show the image when progress is 100%:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "img",
  "style": {
    "width": "100px",
    "display": "=if([$Progress]==1, 'block', 'none')"
  },
  "attributes": {
    "src": "=if([$Progress]==1, 'https://contoso.sharepoint.com/sites/HR/SiteAssets/Servicers.png', '')"
  }
}

Where Progress is the internal name of your SharePoint list calculated column. You can get the internal name of your SharePoint list columns by following this article: How to find the Internal name of columns in SharePoint Online?

Example Output:

enter image description here

4
  • 1
    That worked!! Thank you!!
    – user110812
    Dec 22, 2023 at 13:28
  • You're welcome, glad it worked for you! Dec 22, 2023 at 13:47
  • I am checking the status of this case. Please let us know if you would like further assistance. If you have any update about this issue, please feel free to post back.
    – Xyza_MSFT
    Dec 26, 2023 at 1:47
  • Hi @user110812, can you please Upvote(^) & accept my response as an Answer as it helped you & it will help others with similar question in future. It also removes this question from "Unanswered Questions" list. Thank you! Dec 27, 2023 at 17:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.