Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

help creating a variable

Hi All,

I need help creating a variable.

I have the following fields:

[Reporting Period Index]

[Reporting Date]

I want to create 2 variables that will give me the start and end dates of the previous reporting period index.

eg.

Currently in reporting period index 103

previous Reporting Period Index = 102

reporting dates for previous period = 27/12/2012 - 31/01/2013.

so i would want the variable to show 27/12/2012

and the same for the end date. so a 2nd variable would show 31/01/2013

Can anyone help me please?

3 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Something like this:

vStartPreviousPeriod: min({<[Reporting Date]=,[Reporting Period Index]={$(max([Reporting Period Index])-1)}>} [Reporting Date])

vEndPreviousPeriod: max({<[Reporting Date]=,[Reporting Period Index]={$(max([Reporting Period Index])-1)}>} [Reporting Date])

You'll have to select a reporting date or a reporting period index otherwise you simply get the start and end of the second last period.


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks that worked! but i have come into work this morning to find that they have changed their mind! they now want to report on previous calendar month instead on period.

I have the following previous  month variable...

vLastMonth = =Month(AddMonths(Date([Reporting Date]),-1))

But i cant seem to get the variable to work in my expression.

sum({<[Reporting Week]=, [Reporting Date]={'=$(=date(vLastMonth))'},[Reason Group] = {'Upgrade'}>} [Revenue Loss])

Any Ideas?

Not applicable
Author

Hi, i have managed to do this now.

thanks