Days of the Week

In Salesforce.com, When doing analysis work on Case trends one might be interested in understanding how the day of the week impacts the number of cases created and closed. As in “How many Cases are Opened on Monday’s as Opposed to other days of the week?”. You will find that this is not standard reporting functionality. Calendar Month and Calendar Day Numeric (1-30) yes but not the actual proper day. For that you will need a formula field which thankfully a quick Google search will return varying levels of solutions. From requiring Apex to using a simple formula.

So why the post? Well as you would expect, to do Cases you need a little extra bit of tweaking to get the formula’s to work.

The formula example you would find is:

CASE(MOD(CreatedDate – DATE(1900, 1, 7), 7), 0, “Sunday”, 1, “Monday”, 2, “Tuesday”, 3, “Wednesday”, 4, “Thursday”, 5, “Friday”, 6, “Saturday”,”Error”)

What I found to work best for Case Close Date:

CASE(MOD(DATEVALUE(CreatedDate) – DATE(1900, 1, 7), 7), 0, “Sunday”, 1, “Monday”, 2, “Tuesday”, 3, “Wednesday”, 4, “Thursday”, 5, “Friday”, 6, “Saturday”,”Error”)

So basically adding the “DATEVALUE” fixes the CreatedDate such that you can perform the necessary Math and Case functions.

Here’s the link with the example: https://success.salesforce.com/ideaView?id=087300000006tam

And this one: https://success.salesforce.com/ideaView?id=08730000000BpcE

Leave a Reply

Your email address will not be published. Required fields are marked *