Applying Conditional Formatting to Specific Columns in Sisense Pivot2
Applying Conditional Formatting to Specific Columns in Sisense Pivot2
Summary
Learn how to make all "Yes" values in a specific column of your Sisense pivot highlighted with a green background. The solution was tested on the L2024.2 Sisense version.
How to achieve it?
-
Access Your Dashboard:
- Open your Sisense pivot in the edit mode -> click 3 dots menu -> Edit Widget Script.
-
Update the Widget Script:
- Use this script to highlight "Yes" values:
widget.transformPivot({ type: ['member', 'rows', 'value', 'grandtotal'] }, function (metadata, cell) { if (cell.value === 'N\\A' || cell.value === 'N//A' || cell.value === 'N\A' || cell.value === ' ' || cell.value === null || cell.value === undefined) { cell.value = '-'; cell.content = '-'; } if (cell.content === 'Yes' && metadata.colIndex === 7) { cell.style.backgroundColor = '#48ed42'; } });- Adjust metadata.colIndex to match your target column (starting from 0).
-
Apply and Test:
- Save the changes and refresh the dashboard.
Troubleshooting Tips
-
Verify Column Index:
- Ensure the column index is correct.
-
Check for Errors:
- Look for any syntax errors in the script.
-
Test Before Deployment:
- Test in a development environment first.
Following these steps, you can effectively apply conditional formatting to your Sisense dashboard.
Disclaimer: Please note that this blog post contains one possible custom workaround solution for users with similar use cases. We cannot guarantee that the custom code solution described in this post will work in every scenario or with every Sisense software version. As such, we strongly advise users to test solutions in their environment prior to deploying them to ensure that the solutions proffered function as desired in their environment. For the avoidance of doubt, the content of this blog post is provided to you "as-is" and without warranty of any kind, express, implied, or otherwise, including without limitation any warranty of security and or fitness for a particular purpose. The workaround solution described in this post incorporates custom coding, which is outside the Sisense product development environment and is, therefore, not covered by Sisense warranty and support services.
Zach Williams
·11 months agoI have something similar where I am using 1 and 0 to make Yes and No in the values rows then I color as needed. However when I export to Excel or PDF I lose all formatting since the formatting is done in the widget script. In the PDF preview the formatting is still there but when I download the PDF it is removed. Is there a way to maintain the values and formatting of the widget on export?
Ilya Kvashenko
Admin10 months agoHello zach_myt
Please reach out to Sisense Support on this matter via ticket.
As for Excel it is expected that it does not contain any modifications (its export does not consider widget script by design), however for PDF export it might be expected to be seen there as well as in preview. Relevant team can help you to check this script in details.
Best regards,
Illia
DRay
·1 year agoFor general information about Pivot Tables, see our documentation here: https://docs.sisense.com/main/SisenseLinux/pivot.htm
To learn about designing visualizations, check out this Sisense Academy course: https://academy.sisense.com/fundamentals-of-ux-dashboard-design