Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculate Trend Line

Hi, I have been trying for weeks to figure this out but still have not succeeded.  I created a chart to show supply and demand side-by-side with weeks as my dimension.  I want to add a trend line to the graph that displays ending inventory from the week before.

The calculation for this week's ending inventory is [Last Week's Ending Inventory] + [Supply] - [Demand].  It seems simple but I can't figure it out.  How would I write the calculation for ending inventory by week? 

Here is a picture of what I am trying to accomplish:

inventory.JPG

1 Solution

Accepted Solutions
pover
Luminary Alumni
Luminary Alumni

One option is you use above([End Inventory]) to call the previous ending inventory, but you have to view all weeks for it to work. 

Another option is the AsOf table.  You can find examples in the community allows you to accumulate values over time when you are using time as your dimension.

Karl

View solution in original post

3 Replies
pover
Luminary Alumni
Luminary Alumni

One option is you use above([End Inventory]) to call the previous ending inventory, but you have to view all weeks for it to work. 

Another option is the AsOf table.  You can find examples in the community allows you to accumulate values over time when you are using time as your dimension.

Karl

Not applicable
Author

Will the above function still work since I am calling ending inventory from the previous week, even though ending inventory from that week is calculated from the one before that?

pover
Luminary Alumni
Luminary Alumni

Yes, you can refer to a column in the above row that refers to the row above it.  I attached a simple example.

Karl