Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
richard_chilvers
Specialist
Specialist

Select data for the last 2 years

Hi

I'm not new to QV, but still find date functions confusing !

Please can someone advise a good way of selecting data for the last 24 months?

For example, if today is 15th February 2012, I'd like the data from all months from (and including) February 2010.

Thanks

4 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

use the following expression

=Sum({<DateFieldName={'>=$(MonthStart(Max(DateFieldName), -24))<=$(=Max(DateFieldName))'}>} Sales)

If you want to exclude the selection of month, year and any other date related filters

=Sum({<Year=, Month=, Week=, DateFieldName={'>=$(MonthStart(Max(DateFieldName), -24))<=$(=Max(DateFieldName))'}>} Sales)

Hope this helps you.

Regards,

Jagan.

richard_chilvers
Specialist
Specialist
Author

Hi

Thanks for your reply.

It is not working for me yet. But it has given me some ideas about how I might use sets to find an answer.

Disappointing it needs to be this complicated - I feel there must be a simple solution that I'm missing !

Regards

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Can you provide me the details what fields you have related to the date?

     Date field is in which format normal date or time stamp?

Celambarasan

jagan
Luminary Alumni
Luminary Alumni

Hi,

Can you attach sample file.

Regards,

Jagan.