How to Sort the count numbers in multi level pivot table report

Naresh_5120
Tera Contributor

Hi Community,

 

I have requirement to prepare a multiple level pivot report, I am able prepare that but i am not able to sort the count numbers from large to small (order wise). Can someone help me , how can i achieve this.

 

Naresh_5120_1-1737024190536.png

 

1 REPLY 1

MackI
Kilo Sage

Hi @Naresh_5120 

 

I hope you are well.

 

ServiceNow's reporting module is great for quick reports and visualizations, but it doesn't inherently handle sorting by aggregated values in pivot tables well.
The workaround using scripting gives you the most control and allows you to create complex logic or handle specific edge cases if needed.
 
If you have the necessary permissions, you could create a database view that pre-calculates the counts and then build your report on that view. This can be slightly faster for very large datasets but is less flexible than scripting.
 
 
ServiceNow's reporting module has limitations when sorting by calculated values in pivots. The most robust way to achieve this is by using GlideAggregate in a script (either a "Before" Business Rule on the report or a separate Script Include).
 
Another approach would be Database view (create a new database view) but in your scenario, it would be not as flexible as script based solution.
 
If you like my concept in terms of resolving your query then mark this your best answer‌(Accepted Solution) 🌠‌ OR  mark it  Helpful ‌‌ if you think that you get some insight from this content relevant to your problem and help me to contribute more to this community
 
For details script and complete solution, please accept my concept as your preferred Accepted solution.Thanks
MackI | ServiceNow Developer | 2 *Mainline Certification | LinkedIn Top IT Operation Voice 2023 | Sydney,Australia