Is there a way to do a PA Breakdown by day of week?

George P
Tera Guru

Is there a way to do a PA Breakdown by day of week?  For example, I have have an indicator for New Incidents Daily.  What my management would like to see is a trend of new tickets on Monday, Tuesday, etc.  In other words, if yesterday was Monday, was it like every other Monday or higher, or lower ticket volume.  I know I can do this with a trend chart, but that runs on the live data and I would prefer for it to run on the PA Collections.

Thanks in advance,

George Palm

1 ACCEPTED SOLUTION

George P
Tera Guru

As a follow-up, after much patience and research, I have been able to create a Day of Week breakdown without any new fields.  Here are the basics if someone else is looking to do this.

1. Create a Bucket Group named Day of Week.  Add an entry for each Day starting with Monday (unless your week start day is different) with values as follows.

Monday START = 1, END = 2

Tuesday START = 2, END = 3

Wednesday START = 3, END = 4

Thursday START = 4, END = 5

Friday START = 5, END = 6

Saturday START = 6, END = 7

Sunday START = 7, END = 8

 

2. Create a Breakdown source Day of Week

Facts Table = Bucket

Field = Sys ID

Condition: Bucket Group = Day of Week

 

3. Create a script (table of your choice, one script per table)

Field = any date/time field

var getDayOfWeek = function (x){

var gdt = new GlideDateTime(x);

return gdt.getDayOfWeekLocalTime();

};

getDayOfWeek(current.field name from above);

 

4. Create an Automated Breakdown Day of Week

Breakdown Source = Day of Week

 

5. Create a Breakdown mapping - Use the same table as you used for the script.  Be sure to reference the correct script.

6. Add breakdown to Indicators and run your collections.

View solution in original post

5 REPLIES 5

Dan_Kane
ServiceNow Employee
ServiceNow Employee

Ultimately the best way to accomplish this would be to add a calculated field to the Task (Incident) table. The field would populate with the day of the week based on the opened_at time stamp.

Here is a reference to pulling the day of week from a date/time field.

 

Thank you for the reply.  I will work with our developers to get the fields I need created.

George P
Tera Guru

As a follow-up, after much patience and research, I have been able to create a Day of Week breakdown without any new fields.  Here are the basics if someone else is looking to do this.

1. Create a Bucket Group named Day of Week.  Add an entry for each Day starting with Monday (unless your week start day is different) with values as follows.

Monday START = 1, END = 2

Tuesday START = 2, END = 3

Wednesday START = 3, END = 4

Thursday START = 4, END = 5

Friday START = 5, END = 6

Saturday START = 6, END = 7

Sunday START = 7, END = 8

 

2. Create a Breakdown source Day of Week

Facts Table = Bucket

Field = Sys ID

Condition: Bucket Group = Day of Week

 

3. Create a script (table of your choice, one script per table)

Field = any date/time field

var getDayOfWeek = function (x){

var gdt = new GlideDateTime(x);

return gdt.getDayOfWeekLocalTime();

};

getDayOfWeek(current.field name from above);

 

4. Create an Automated Breakdown Day of Week

Breakdown Source = Day of Week

 

5. Create a Breakdown mapping - Use the same table as you used for the script.  Be sure to reference the correct script.

6. Add breakdown to Indicators and run your collections.

Dan_Kane
ServiceNow Employee
ServiceNow Employee

Hi George,

As an FYI, while that method will work, we do not recommend using scripted breakdown mappings unless there is no other alternative. The reason for this is that, as your facts tables get larger over time, scripts can have a significant drain on system memory, and could cause platform performance issues during the collection process.

Ultimately the best practice solution is still creating a Day of Week field on the task itself. The field could be auto calculated via a Business Rule, and could leverage the script you are using in the breakdown mapping.

You can reference this community blog for more info.

Dan