Skip to main content
Announcements
Qlik Community Office Hours - Bring your Ideation questions- May 15th, 11 AM ET: REGISTER NOW
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
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.