Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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:)

1 Solution

Accepted Solutions
swuehl
MVP
MVP

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
MVP
MVP

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