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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
jerryr125
Creator III
Creator III

Data Load - Calculate the difference between cumulative values

Hi - 

I am not entirely sure if the following can be accomplished.

On the data load, I would like to calculate the difference between values instead of the cumulative value.

That is, by date and location, determine the difference in quantity between the two dates.

Example:

 

jerryr125_1-1620132962282.png

 

Therefore, the OUTPUT is the results I am attempting to achieve for the data load.

Any thoughts ? 

Thanks - Jerry

 

1 Solution

Accepted Solutions
JuanGerardo
Partner - Specialist
Partner - Specialist

Hi @jerryr125 , you can use the Previous() function to calculate this difference:

Output:

Load

   Date,

   Location,

   If(Location = Previous(Location), [Quantity Sold Cummulative] - Previous([Quantity Sold Cummulative]), [Quantity Sold Cummulative]) AS [Quantity Sold]

Resident Input  // Or from your data connection

Order by Location, Date;

 

JG

View solution in original post

2 Replies
JuanGerardo
Partner - Specialist
Partner - Specialist

Hi @jerryr125 , you can use the Previous() function to calculate this difference:

Output:

Load

   Date,

   Location,

   If(Location = Previous(Location), [Quantity Sold Cummulative] - Previous([Quantity Sold Cummulative]), [Quantity Sold Cummulative]) AS [Quantity Sold]

Resident Input  // Or from your data connection

Order by Location, Date;

 

JG

jerryr125
Creator III
Creator III
Author

Thank you - perfect ! Jerry