Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Contributor II

Rolling 12 months for sum and count

Hi everyone,

I want to have rolling 12 months on Sum and Count measure.

I have seen many post related to this, but nothing worked well with my scenario-

here is my scenario -

I have field as =

This is my Datefield =Period("MMM-YYYY") 

Sum(sales)

Count({<Sale= {'External'} >} ExternalSale)

So now i need to have rolling 12 months(From this October 2019 to October 2018)  in the above sum and Count measure.

what is the best way ?

 

Thanks in advance! 

 

 

 

 

 

1 Solution

Accepted Solutions
Highlighted
Contributor II

Re: Rolling 12 months for sum and count

Finally with some trail and error method i came up with right fix.

Please find the script below-

SUM({< Period = {">=$(=Date(MonthStart(Today(),-12),'MMM-YYYY'))<=$(=Date(MonthStart(Today()),'MMM-YYYY'))"} >}[Sales})

Count({<Sale= {'External'}, Period = {">=$(=Date(MonthStart(Today(),-12),'MMM-YYYY'))<=$(=Date(MonthStart(Today()),'MMM-YYYY'))"} >} ExternalSale)

 

Thanks to myself! 🙂

 

View solution in original post

1 Reply
Highlighted
Contributor II

Re: Rolling 12 months for sum and count

Finally with some trail and error method i came up with right fix.

Please find the script below-

SUM({< Period = {">=$(=Date(MonthStart(Today(),-12),'MMM-YYYY'))<=$(=Date(MonthStart(Today()),'MMM-YYYY'))"} >}[Sales})

Count({<Sale= {'External'}, Period = {">=$(=Date(MonthStart(Today(),-12),'MMM-YYYY'))<=$(=Date(MonthStart(Today()),'MMM-YYYY'))"} >} ExternalSale)

 

Thanks to myself! 🙂

 

View solution in original post