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: 
Mayuri1
Contributor II
Contributor II

date difference by rows for a single column

Hi,

How can I generate a column to display the difference between two rows? 

date
1/17/2019
1/17/2019
1/20/2019
1/20/2019
1/21/2019
1/21/2019
1/21/2019
1/21/2019
1/21/2019
1/21/2019
1/21/2019
1/21/2019
1/22/2019
1/22/2019
1/22/2019
1/22/2019
1/22/2019
1/22/2019
1/22/2019
1/23/2019
1/23/2019
1/23/2019
1/23/2019
1/24/2019
1/24/2019
1/24/2019
1/24/2019
1/24/2019
1/24/2019
1/24/2019
1/24/2019
1/25/2019
1/25/2019
Labels (1)
2 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Assuming date is a numeric date field:

LOAD date, 
    if(RowNo() <> 1, date - previous(date)) as diff
....
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
MindaugasBacius
Partner - Specialist III
Partner - Specialist III

I guess firstly you need to make an Order by Invoice number (some other metric) and by date itself. Than you can move on to Jontydkpi suggestion.