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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Forecast

Hi, I like to show an forecast. (simulation)

Here an example of my problem.

name, Date, value

TYP A, Nov15, 99

I have many of these types but I like to reduce the value each month of -1

Here the result:

Typ A, Dez 15, 98

Typ A, jan16, 97

Typ A, Feb16, 96 ....etc

any ideas?

MANY THANKS:)

Labels (1)
1 Solution

Accepted Solutions
swuehl
Champion III
Champion III

Something along these lines should do the trick:

Let vMaxForecastDate = num(Makedate(2017,1,1));

LOAD *,

  Date(addmonths(Date,iterno()-1),'MMMYY') as ForecastDate,

  value-(iterno()-1) as ForecastValue

While addmonths(Date,iterno()-1) <= $(vMaxForecastDate);

LOAD name, Date#(Date,'MMMYY') as Date, value

INLINE [

name, Date, value

TYP A, Nov15, 99

TYP B, Jan16, 121

];

View solution in original post

2 Replies
swuehl
Champion III
Champion III

Something along these lines should do the trick:

Let vMaxForecastDate = num(Makedate(2017,1,1));

LOAD *,

  Date(addmonths(Date,iterno()-1),'MMMYY') as ForecastDate,

  value-(iterno()-1) as ForecastValue

While addmonths(Date,iterno()-1) <= $(vMaxForecastDate);

LOAD name, Date#(Date,'MMMYY') as Date, value

INLINE [

name, Date, value

TYP A, Nov15, 99

TYP B, Jan16, 121

];

Not applicable
Author

YOU HELP ME A LOT:)

THANKS TO YOU