- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2023 06:25 AM - edited ‎11-10-2023 11:43 AM
Hello. I am trying to build a chart to show the count of incidents created by day of the week over a rolling 12-month period. The issue is that it shows the day of the week by year (Sunday 2022, Sunday 2023) resulting in 14 columns. How can I combine multiple years into one so there are only 7 columns with each representing a day of the week? Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2024 01:28 AM
1. Create a new field in the Incident table. You can name it "Day of Week". This field will hold the day of the week when the incident was created.
2. Create a Business Rule that will populate this field every time an incident is created or the creation date is updated. The script could look something like this:
javascript
(function executeRule(current, previous /*null when async*/) {
var gdt = new GlideDateTime(current.sys_created_on);
current.u_day_of_week = gdt.getDayOfWeek();
})(current, previous);
3. Now, you can create a report that groups by this new field "Day of Week". This will give you a count of incidents created on each day of the week, regardless of the year.
4. To ensure the report only includes incidents from the last 12 months, add a condition to the report to filter incidents where the creation date is on or after 12 months ago.
5. Finally, sort the report by the "Day of Week" field to have the days in order.
Please note that this is a high-level overview and you may need to adjust the steps based on your specific ServiceNow setup and requirements.for further details please visit our site https://nowkb.com/home
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2024 01:28 AM
1. Create a new field in the Incident table. You can name it "Day of Week". This field will hold the day of the week when the incident was created.
2. Create a Business Rule that will populate this field every time an incident is created or the creation date is updated. The script could look something like this:
javascript
(function executeRule(current, previous /*null when async*/) {
var gdt = new GlideDateTime(current.sys_created_on);
current.u_day_of_week = gdt.getDayOfWeek();
})(current, previous);
3. Now, you can create a report that groups by this new field "Day of Week". This will give you a count of incidents created on each day of the week, regardless of the year.
4. To ensure the report only includes incidents from the last 12 months, add a condition to the report to filter incidents where the creation date is on or after 12 months ago.
5. Finally, sort the report by the "Day of Week" field to have the days in order.
Please note that this is a high-level overview and you may need to adjust the steps based on your specific ServiceNow setup and requirements.for further details please visit our site https://nowkb.com/home
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2024 01:32 AM
Hi @Phil2zero22 ,
You can't unless you will create a lot of extra work as suggested by @servicenowdona (AI reponse) - this is ServiceNow standard behavior when creating the report through the report designer.
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/