Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
priyarane
Specialist
Specialist

Last 13 months Sales

Hi Experts,

I want to have the Sum(Sales) for last 13 months including current month.

My filter name - MonthYear

My script looks like this for Date fields

     MonthEnd(Date#(Reporting_Date,'YYYYMM')) as Reporting_Date,
     Month(Date#(Reporting_Date,'YYYYMM')) & ' '  & PurgeChar(year(Date#(Reporting_Date,'YYYYMM')),'20') as MonthYear,

You can find my application.

Based on MonthYear selection I should get for last 13 months including current month.

Right now I have Sep14 ony, but tonight I will get total data. So I need to put expression before reload.

6 Replies
timanshu
Creator III
Creator III

Hi Priya,

1) Create a variable. Example  vCustomDate = Date(AddMonths(Reporting_Date,-13)).

2) write expression as  = Sum({<Reporting_Date='>=$(=vCustomDate)<=Reporting_Date'>}Sales)

This will work for you.

priyarane
Specialist
Specialist
Author

Hi Tim,

I guess in Expression, we have syntax error,

Could you please correct it? I am not able to get it

MK_QSL
MVP
MVP

What is the Format of MonthYear and Reporting_Date?

priyarane
Specialist
Specialist
Author

MonthEnd(Date#(Reporting_Date,'YYYYMM')) as Reporting_Date

MK_QSL
MVP
MVP

MonthYear?

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Something like this should do it:

Sum({<Reporting_Date={">=$(=AddMonths(Max(Reporting_Date), -13))"}>} Sales)

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein