Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date

I am trying to write a script to meaures the number saves a service rep gets, for which they receive credit 60 days later. So if the rep has a save in March he would receive credit for it in May. Any clue on how to write that in the script.

I have attached my script for reference. I appreciate all the help.

Thank you,

5 Replies
Not applicable
Author

You could calculate the date the rep gets credit via dateadd functions. This could be done by either adding months or days to your save date value. This adds 60 days to the date: date(DateFieldName + 60, 'MM/DD/YYYY').

Not applicable
Author

Hi Langar,

What I am essentially trying to do when ever someone has a save, to look two months back. For example, in april, an agent would receive credit for the saves they had in feb. I loaded an inline table to correlate the yearmonth to look at two months back. I am not sure how to apply that to my master table. I am not sure if this this is a good approach.

I have attached the file for your reference.

Please help!

SavesMap:

Mapping Load * INLINE

[CountYearMonth, SavesYearMonth,

'2010-Jan','2010-Mar',

'2010-Feb','2010-Apr',

'2010-Mar','2010-May',

'2010-Apr','2010-Jun',

'2010-May','2010-Jul',

'2010-Jun','2010-Aug',

'2010-Jul','2010-Sep',

'2010-Aug','2010-Oct',

'2010-Sep','2010-Nov',

'2010-Oct','2010-Dec',

'2010-Nov','2011-Jan',

'2010-Dec','2011-Feb',

'2011-Jan','2011-Mar',

'2011-Feb','2011-Apr',

'2011-Mar','2011-May',

'2011-Apr','2011-Jun',

'2011-May','2011-Jul',

'2011-Jun','2011-Aug',

'2011-Jul','2011-Sep',

'2011-Aug','2011-Oct',

'2011-Sep','2011-Nov',

'2011-Oct','2011-Dec',

'2011-Nov','2012-Jan',

'2011-Dec','2012-Feb',

'2012-Jan','2012-Mar',

'2012-Feb','2012-Apr',

'2012-Mar','2012-May',

'2012-Apr','2012-Jun',

'2012-May','2012-Jul',

'2012-Jun','2012-Aug',

'2012-Jul','2012-Sep',

'2012-Aug','2012-Oct',

'2012-Sep','2012-Nov',

'2012-Oct','2012-Dec',

'2012-Nov','2013-Jan',

'2012-Dec','2013-Feb',

];

Not applicable
Author

I think the approach of having the inline map will be cumbersome for you to maintain as time goes on. If you load the data from your script (I assume the 'Date' field is the date of the "Save") and calculate the date the rep receives credit things will be much easier. I have attached an example.

Not applicable
Author

If you want to maintain your mapping load, this is the syntax to join it to your data:

applymap('SavesMap', Year(Date) & '-' & Month(Date), 'Not Mapped') as FieldName

Not applicable
Author

In an applymap statement, you need the mapping you are applying, the field you are mapping to, and (optionally) a value for the un-mapped values from the field. In this instance, "Not Mapped" will appear if the mapping load does not contain a Month-Year combo found in the data set.