Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
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
Partner

something like the attached?

giakoum
Partner
Partner

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
Partner

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