Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
ganeshreddy
Creator III
Creator III

Previous 6 months sum in Script level ?

Hi All,

How can i calculate previous 6 months Sales here in below script.

Note: In UI level i can achieve this, finding difficulty to calculate in script level .

Thank You,

Cheers,

Ganesh

7 Replies
Anonymous
Not applicable

use set analysis

sum({<yourdatefield={'>={$(=addmonths(max(yourdatefield),-6))}<=yourdatefield{$(=max(yourdatefield))}'}>}sales)

maybe you need to adjust expression

ganeshreddy
Creator III
Creator III
Author

Hi Rudolf,

I suppose we can not use set analysis in script. I want to calculate in Script as like Sum(Sales) which i did in script.

Cheers,

Ganesh

giakoum
Partner - Master II
Partner - Master II

something like the attached?

giakoum
Partner - Master II
Partner - Master II

note the set statement :

SET DateFormat='DD/MM/YYYY';

and use a calendar :

Understanding the Master Calendar (video)

abhaysingh
Specialist II
Specialist II

Hi ioannis,

if i want Current Month vs next 3 rolling month than what i need to do?

thanks

giakoum
Partner - Master II
Partner - Master II

AsOfMonth:

load

Month as Month_AsOf,

Month + 1 + IterNo() as Month

Resident tmp_SO

while IterNo() <= 3;

plus in IterNo instead of minus

and 3 instead of 6 in the while clause

see Calculating rolling n-period totals, averages or other aggregations for more details / suggestions

pratap6699
Creator
Creator

sum({<datefield={">=$(=addmonths(max(datefield),-6))<=datefield$(=max(datefield))"}>}sales)

use if() in script level