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: 
gitguto
Contributor III
Contributor III

Using Last Value as a calculation paramenter

Hello everyone,

I have a table like this:

PRODUCT ID MONTH SALES QTY SALES $$ PRICE FCST QTY FCST $$
A FEB 10 200 20    
A MAR 10 220 22    
A APR 20 440 22    
A MAY 20 500 25    
A JUN - -   20 (20*25)
A JUL - -   10 (10*25)
B JAN 100 200 2    
B MAR 150 450 3    
B AUG - -   100 (100*3)

 

What I need to do is to calculate the last column (Forecast $$). In order to do so, I have to calculate the last practiced price ($$ Sold / Qty Sold in the last available month). And then, use it to multiply by the Sales Qty Forecast.

I tried =Sum(Aggr(FirstSortedValue([Sales $$]/[Sales Qty], -[DATE.autoCalendar.Month]), [PRODUCT ID])) but it returns me nothing.

 

Thank you!

Labels (2)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

As below

=Sum([FCST QTY])*
FirstSortedValue(total <PRODUCTID> aggr(sum([PRICE]),PRODUCTID,Month),-aggr(if(sum(PRICE)>0,Month),PRODUCTID,Month))

 

qlikCommunity1.PNG

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

2 Replies
vinieme12
Champion III
Champion III

As below

=Sum([FCST QTY])*
FirstSortedValue(total <PRODUCTID> aggr(sum([PRICE]),PRODUCTID,Month),-aggr(if(sum(PRICE)>0,Month),PRODUCTID,Month))

 

qlikCommunity1.PNG

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
gitguto
Contributor III
Contributor III
Author

Thank you! Works perfectly