Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Cumulative data

Is there anyone how can help me with this issue?

I have the following camulative data:

Year     Month     Fact

2011     1               100

2011     2               150

2011     3               300

2012     1               80

2012     2               120

2012     3               200

For each year I want to calculate in my script the difference between the month's.

So the following data is what I need:

Year     Month     Fact

2011     1               100

2011     2               50

2011     3               150

2012     1               80

2012     2               40

2012     3               80

What script/function must I use to get the data between the month's for each year separate?

1 Reply
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Something like this:

LOAD Year,

          Month

          Amount

          Amount - Alt(Previous(Amount), 0) As Difference,

          ...

FROM SourceTable

ORDER By Year, Month

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein