Posted: 2011-08-08 10:50 |
Often users have a requirement to build a report with criteria based on the date of a particular field compared with the current date. For example, you might want to report on the Contracts that are due for renewal within the next 60-90 days so that you can contact your customers and send them a reminder, or you might want to see all the Opportunities that are due to close in more than 30 days time, and so on. Let's take the first example and build a report that shows all the Contracts due for renewal within the next 60-90 days. First, add a calculated column to your report called Date Difference that shows the difference in days between the renewal date and today's date, which will use the following formula:
(Of course, you can substitute in a different field name instead of end_date to apply this formula to different pieces of data.) Next, to identify the Contracts that are due to expire within 60-90 days, apply two calculated criteria on the Date Difference column, as follows:
And that's it. Remember, of course, that every time you run this report, the records shown will vary depending on number of days between the current date and the field you've identified in the report. If you simply wanted a report that showed, say, all the Contracts due to expire in September 2011, you'd add a couple of criteria like the ones below:
This time, no matter when you open the report, you'll see all those Contracts with an expiry date sometime in September 2011. |
Posted: Wed, 10.08.2011 - 10:29 |
That is really helpful - I am new to the reporting functions so am trying to get to grips with them. I want to build a report which shows how many days it is since I last met or spoke with a contact that is attached to a particular campaign. I understand the logical steps: 1. Identify those contacts attached to the campaign 2. Identify the most recent meeting or phone call activity 3. Take this date and take it away from todays date From your notes above, I can do 1 and 3. I am struggling with 2. Can you help? Thanks |
Posted: Wed, 17.08.2011 - 14:22 |
Glad the article was helpful and you'll be pleased to know that you can build the sort of report you're looking for using the MAX function. Here's a link to some information on using MAX.
The following steps should enable you to build the report you want BUT, do be aware that the report built here only looks at Activities that were created by clicking on the one of the icons at the end of the Campaign Membership row (which are then listed in the Activities tab for that particular Campaign), as shown in the screenshot below (click to enlarge):
So, to build your report, start by creating a report based on Marketing Campaigns. You'll probably want to apply a criteria to narrow the report down to a specific Campaign. (Some of the steps below are included to illustrate the logic of how the final formula is built. These steps are shown in blue. You might want to just use the steps in black and simply copy the formula provided.)
Add a column to show the person by choosing Activities ► Primary Contact. (NOTE: To make the report 'neater' you can rename this column to, say, Person.)
Now, you want to see how long ago you last met or spoke to that contact. For the purposes of this example, I'm assuming you'll use the Completed Date from an Activity to identify when that was but ... only Task Activities include this field, Meetings do not so first of all I'm going to add a column that displays the End Date if the Activity is of type Meeting and the Completed Date if the Activity is of Type Task. (The End Date for a Meeting is actually a date/time field, but that doesn't impact on report we're building.) For this, use the formula below:
IF( activities.activity_type = 'Meeting', activities.end_datetime, activities.completed_date)
If you click Refresh preview at this point, you'll see a list of all the Activities against the Campaign, together with a Date Completed column but it's quite likely that there are multiple Activities for the same person. We'll deal with this by summarising the report later.
Next, you can add a column to show the most recently completed Activity by taking the formula above, and prefixing it with MAX, as shown below:
MAX(IF( activities.activity_type = 'Meeting', activities.end_datetime, activities.completed_date))
When you click Refresh preview you'll see that your report has now been rolled up into just one row. To see the most recent Activity for each person, open the Summarise by tab and add a column that summarises by the Person. Click Refresh preview again and you'll now see just one row per person.
Finally, you can add a column to show you the number of days it is since the person was last contacted (in respect of this particular Campaign) by adding the following formula:
DATEDIFF(CURDATE(), MAX(IF( activities.activity_type = 'Meeting', activities.end_datetime,activities.completed_date))) NOTE: It's important to be aware that the MAX function only works to show you the most recent date. If you then add a column to show, say, the Activity subject, this does not display the subject of the most recent Activity. |
Posted: Tue, 13.08.2013 - 11:47 |
For the second post made by the Workbooks Support Team, please take a look at the information below: In the next release of Workbooks, due out in late summer, you can build the same report by undertaking the following steps:
The details view now shows Campaigns and information related to any Activities to these Campaigns. A summary view can be created to show the most recent meeting and the days passed since the last activity. To do this:
'MAX(IF( PARENT('Type') = 'Meeting', PARENT('End'), PARENT('Completed Date')))'
'MAX(IF( PARENT('Type') = 'Meeting', PARENT('End'), PARENT('Completed Date')))'
The resulting report should look something like this (click to enlarge).
This report was created on the 13/08/2013 and the 'days passed since most recent activity' uses this date to make its calculation. |