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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

DIFFERENCE BETWEEN DATES

I have a table with date, customer, quantity and I need to know the variation amount from the previous date

DATECUSTOMERQUANTITY
2016-01-013125
2016-01-033148
2016-01-072480
2016-01-12185
2016-01-213198

EXAMPLE: CUSTOMER 3 ON 21TH ->  198-148= 50

1 Reply
swuehl
Champion III
Champion III

If you want to calculate this in the script:

Result:

LOAD

     Customer,

     Date,

     Quantity,

     If(Previous(Customer) = Customer, Quantity- Previous(Quantity) ) as Diff

RESIDENT YourTable

ORDER BY Customer, Date;

DROP Table YourTable;