Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Last 12 month and Previous 12 month

Hi,

I want to compare the Sum of sales for the last 12 month and for the previous 12 month on the scatter plot

For example, I compare these 2 dates : 12/03/2017 - 12/04/2018 and 12/03/2016 - 12/04/2017

I use this formula to calculate last 12 Month

Sum({<date={">=$(=timestamp(MonthStart(Today(),-12)))<=$(=timestamp(Today()))"}>}FactSoldAmount)


To compare Last 12 month to the Previous 12  month I wrote this, but it doesn't seem correct. Can someone help me ?



Sum({<date={">=$(=timestamp(MonthStart(Today(),-12)))<=$(=timestamp(Today()))"}>}FactSoldAmount)

-

Sum({<date={">=$(=timestamp(MonthStart(Today(),-24)))<=$(=timestamp(Today(),-12))"}>}FactSoldAmount)

5 Replies
Chanty4u
MVP
MVP


current 12months

=SUM({$<DateField = {'>=$(=YearStart(Today()))<=$(=MonthEnd(Today()))'}>}sales)

last 12months

=SUM({$<DateField = {'>=$(=AddMonths(YearStart(Today()),-12))<=$(=AddMonths(MonthEnd (Today()),-12))'}>}sales)

Anonymous
Not applicable
Author

I don't want current 12 Months.

Today is April I want to have all months from 2017 March to 2018 April and From 2016 March to 2017 April ---- I want something like this. And also, I should see the difference between these years

YoussefBelloum
Champion
Champion

Hi,

What is you Date field format ?

why do you use timestamp ?

Last 12 month and Previous 12  month

passionate
Specialist
Specialist

Previous 12 months can be best Achieved in data model.

PFA Solution.

potti222
Contributor
Contributor

Hello

am also new to qlik...I tried check check below expressions.

Mrach 2017-April 2018

=SUM({<OrderDate = {">=$(=YearStart(Today(),-1,3))<=$(=MonthEnd(Today()))"}>}Sales)

March 2016- April 2017

=SUM({<OrderDate = {">=$(=YearStart(Today(),-2,3))<=$(=YearEnd(Today(),-2,4))"}>}Sales)