Skip to main content
Announcements
The New Qlik Learning Experience is Here! GET STARTED
cancel
Showing results for 
Search instead for 
Did you mean: 
chriys1337
Creator III
Creator III

Calculating the average and difference between two months in Load Script

Hi all,

I am loading a very simple table in QlikView with a date and a specific Index, see screenshot below.

Now I would like to calculate in the Load Scirpt the Average between two months, for example for moth 201602: (66,33+66,33)/2= 66,33 in Average and the difference between two months for example in month 201605 64-65=-1 .

I know how to do it with Set Analysis in the Front End unfortunately it must be a calculation in the Script, so can anybody help me with this please?

Kind Regards,

Chris

1 Reply
marcus_sommer

Try it with interrecord-functions within a sorted resident-load (to ensure the order of records is like your needs), maybe something like this:

load

     YearMonth, Date, Average,

     rangeavg(Average, previous(Average)) as AverageTwoMonth,

     Average - previous(Average) as DiffTwoMonth

resident YourSource order by Date;

- Marcus