Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculate last 3 months values

Dear all

How to Calculate value of last 3 months values.

For example on this January 2015,  it will calculate December, November, October 2014 value.

Regards

Sofyan B

7 Replies
its_anandrjs

Hi,

In any chart try this expression

=Sum({<Date = {'>$(=Max((Addmonths(Date,-3)))) <$(=Max (Addmonths(Date,-1)))'}>} Sales)

Or

=Sum({<DateField = {'>$(=Max((Addmonths(DateField,-3)))) <$(=Max(Addmonths(MonthEnd(DateField),-1)))'}>} Sales)

Regards

Anand

Not applicable
Author

Hi Anand

Thanks for your respond

I don't have date column on data there's only year and month column.

Regards

Sofyan B

its_anandrjs

Hi,

In which format your Month and Year fields have better to add Monthyear field in load script or NUM month field.

Regards

Anand

ecolomer
Master II
Master II

here you have an example

senpradip007
Specialist III
Specialist III

Please have a look on this. Hope it will help.

Not applicable
Author

Hi Anand

I wrote this expressions

=Sum({<TransDate= {'>$(=Max((Addmonths(Today(),-3)))) <$(=Max(Addmonths(MonthEnd(Today()),-1)))'}>} Sales_Nett)

it returns 0

Any Suggestion

Regards

Sofyan B

its_anandrjs

Hi,

Your expression is correct and it gives output also some little change use Monthstart with addmonths also

=Sum({<TransDate= {'>=$(=Max(Monthstart(AddMonths(Today(),-3))) ) <$(=Max(Addmonths(MonthEnd(Today()),-1)))'}>} Sales_Nett)

Regards,

Anand