Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
sogloqlik
Creator II
Creator II

Latest version of Production planning forecast

Hi.

 

Every week we pull from our SAP system the current version of our production forecast and add it to the existing data.

The forecast is always onward.

I have a data table (see attached example). It consists of the following:

  • planning date (The date when the product is to be manufactured)
  • Version Date (the date when the production forecast version was taken).
  • The product
  • the planned Qty.

This table is connected to a calendar with planning date as a key.

 

the need is to show for every calendar week the forecast qty of the latest relevant version (For example: for week fifty-one it will show the data of the version taken in week fifty, for week fifty it will show the data of the version taken in week forty-nine and so forth.

The final is outcome supposed to be a pivot table with

  • two dimensions: Year and week 
  • One measure: sum of qty.

 

Any ideas?

 

Labels (4)
1 Solution

Accepted Solutions
pedrobergo
Employee
Employee

Hi @sogloqlik 

You must use FirstSortedValue to retrieve the latest Version Date from each Product and Planned Date. Using your example table, the formula will be:

 

Sum( Aggr( FirstSortedValue(Qty,-[Version Date]), Product, [Planned date]) )

 

pedrobergo_0-1673879548368.png

 

[],

Pedro

View solution in original post

2 Replies
pedrobergo
Employee
Employee

Hi @sogloqlik 

You must use FirstSortedValue to retrieve the latest Version Date from each Product and Planned Date. Using your example table, the formula will be:

 

Sum( Aggr( FirstSortedValue(Qty,-[Version Date]), Product, [Planned date]) )

 

pedrobergo_0-1673879548368.png

 

[],

Pedro

sogloqlik
Creator II
Creator II
Author

Thx.