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: 
userid128223
Creator
Creator

Current Month v. Same Month Last Year

Hi Everyone

I have ticketing application which logs number of calls per month. I have data for 5 years. I want to calculate what variance between calls during same period last year around same month to guage the trend.

How do I go about doing this.

please help.

thanks

1 Solution

Accepted Solutions
Gysbert_Wassenaar

See attached example

edit: see here for an explanation of the approach used.


talk is cheap, supply exceeds demand

View solution in original post

18 Replies
vivek_niti
Partner - Creator
Partner - Creator

Hi,

Pass the current monthyear to a variable in form of a date. Create a second variable using the first variable with addmonths function.

eg:

vCurrDate = Max(Date);

vCurrMonthStart = Date(Floor(Monthstart(max(Date))),'DD-MM-YYYY')

vPrevCurrDate = Date(Addmonths($(vCurrDate),-12),'DD-MM-YYYY')

vPrevMonthStart = Date(Addmonths($(vCurrMonthStart),-12),'DD-MM-YYYY')

Use these variables to limit the dates in the formula.

Regards,

userid128223
Creator
Creator
Author

Thanks Vivek

Can you please explain what your formula does and how it is tied to us getting current month vs same month last year.

I have create a example app with your suggestion can you please take this and show me how you will use this to show current month vs last year same month data trend.

thanks.

userid128223
Creator
Creator
Author

Any update Vivek or anyone else.

thanks

userid128223
Creator
Creator
Author

vPrevMonthStart = Date(Addmonths($(vCurrMonthStart),-12),'DD-MM-YYYY')

is not giving me the right results eather.

vivek_niti
Partner - Creator
Partner - Creator

Hi,

Am leaving for office...will send u the codes later in the evening.....

Regards,

Vivek

Sokkorn
Master
Master

Hi amiuni66,

Here is a clue

Sum({$<Years = {$(=Max(Years)-1)}, MonthNum = {$(=Max(MonthNum))}>} NoOfCalls) ==>Return value in previous year

Sum({$<Years = {$(=Max(Years))}, MonthNum = {$(=Max(MonthNum))}>} NoOfCalls) ==>Returen value in current year

See sample attached file also.

Note: I just add one field in load script Num(Month(IncidentDate)) As MonthNum,

Regards,

Sokkorn

userid128223
Creator
Creator
Author

Thanks Vivek. I will look forward to it.

Thanks Sukkorn. I tried your solution it works without any selection but when you select any month-year it does not show proper results for prior year. it shows Zero.

neha_shirsath
Specialist
Specialist

Hi,

Try this for last year month sales-

Sum ({<Date = P({<Year={$(=max(Year)-1)}>}Date)>}Sales)


Regards,

-Neha

kumarnatarajan
Partner - Specialist
Partner - Specialist

Hi amiumi,

Please check the attached file.This is very useful for you