Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

CALCULATE EXPRESSIONS FOR LAST 12 Months !!

I am creating a report where i need to show data for last 12 months , For e.g ( if i enter date as 5 nov 2014 , then it should show me data from nov 2013 to oct 2014 ) .

Till Now i have created a field with MonthName() function in my script which gives me month along with the year like ( Dec 2014 ,sep2013)  .

Can somebody suggest me the logic which i need to apply over here .

P

Thanks in advance !!

Labels (1)
1 Solution

Accepted Solutions
ashwanin
Specialist
Specialist

7 Replies
PrashantSangle
MVP
MVP

Hi,

Try like

Sum({<datefield={">=$(Date(Addmonths(max(datefield),-12)))<=$(=Date(max(datefield)))}>}Amount)

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 🙂
ashwanin
Specialist
Specialist

ashfaq_haseeb
Champion III
Champion III

Hi,

Check this too

Sum({<DATE={">=$(=MonthStart(Max(DATE),-12)) <=$(=MonthEnd(Max(DATE)))"}>} SALES)

Regards

ASHFAQ

SunilChauhan
Champion II
Champion II

Sum({<datefield={">=$(Date(Addmonths(max(datefield),-12)))<$(=Date(max(datefield)))}>}Amount)

Sunil Chauhan
Not applicable
Author

Hi,

Try like

Sum({<datefield={">=$(Date(Addmonths(max(datefield),-12)))<=$(=monthend(addmonths(max(datefield),-1))}>}Amount)

Regards

SunilChauhan
Champion II
Champion II

yes ashok,you are right .my formula calculate before today and last 12 months

Sunil Chauhan
PrashantSangle
MVP
MVP

Hi,

I missed the = sign in set anlysis

update

Sum({<datefield={">=$(=Date(Addmonths(max(datefield),-12)))<=$(=Date(max(datefield)))}>}Amount)

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 🙂