Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Rolling 4 and 12 month data in Qlikview

Hi,

I am a new learner in qlikview. I am looking for inputs on rolling 4 month and 12 month data.

For eg. If my month is March then rolling 4 months will be Feb, Jan, Dec and Nov

I have used the below expressions but it is not showing any data:

= Sum({<date= {">=$(=Date(AddMonths(max(date),-3),'DD-MMM-YYYY')) <=$(=Date(max(date),'DD-MMM-YYYY'))"}>}Units)

= Sum({<date= {">=$(=Date(AddMonths(max(date),-11),'DD-MMM-YYYY')) <=$(=Date(max(date),'DD-MMM-YYYY'))"}>}Packs)

Could you please provide your inputs.

Thanks in advance!!!!

Rohit

1 Solution

Accepted Solutions
muthukumar77
Partner - Creator III
Partner - Creator III

Hi,

Recheck your date format.

I think format is problem.

Try like,

=Sum({$<Date={">=$(=Date(AddMonths(max(Date),-3),'MM/DD/YYYY'))<=$(=Date(max(Date),'MM/DD/YYYY'))"}>}Unit)

=Sum({$<Date={">=$(=Date(AddMonths(max(Date),-11),'MM/DD/YYYY'))<=$(=Date(max(Date),'MM/DD/YYYY'))"}>}Packs)

Muthukumar Pandiyan

View solution in original post

9 Replies
muthukumar77
Partner - Creator III
Partner - Creator III

Hi,

What is Date format?

Muthukumar Pandiyan
PrashantSangle

Hi,

If your month max(date) month is march and you want to exclude it then

try below

= Sum({<date= {">=$(=Date(Monthstart(AddMonths(max(date),-4)),'DD-MMM-YYYY')) <=$(=Date(MonthEnd(AddMonths(max(date),-1)),'DD-MMM-YYYY'))"}>}Units)

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

Hi MUthukumar,

It's DD-MMM-YYYY i.e. 14-Mar-2017

Thanks,

Anil_Babu_Samineni

Seems, your expression is okay to me. So, I assume your selection will happen for date and you are expecting from Month'

May be this? Or please provide sample

= Sum({<date= {">=$(=AddMonths(max(Month),-3)) <=$(=max(Month))"}>}Units)

= Sum({<date= {">=$(=AddMonths(max(Month),-11)) <=$(=max(Month))"}>}Packs)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
muthukumar77
Partner - Creator III
Partner - Creator III

Hi,

Recheck your date format.

I think format is problem.

Try like,

=Sum({$<Date={">=$(=Date(AddMonths(max(Date),-3),'MM/DD/YYYY'))<=$(=Date(max(Date),'MM/DD/YYYY'))"}>}Unit)

=Sum({$<Date={">=$(=Date(AddMonths(max(Date),-11),'MM/DD/YYYY'))<=$(=Date(max(Date),'MM/DD/YYYY'))"}>}Packs)

Muthukumar Pandiyan
Not applicable
Author

I will try it and let you know with updates.

Thanks,

Rohit

muthukumar77
Partner - Creator III
Partner - Creator III

Did this work?

Muthukumar Pandiyan
Not applicable
Author

I am still getting the same issue, please advice.

Thanks,

Anil_Babu_Samineni

Can you provide sample to work on it

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful