Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
cliff_clayman
Creator II
Creator II

Compare CY and PY data for Current Month

I have a dashboard that compares Current Year totals vs. Previous Year totals for the current reporting month.  The expression for the Current Year is:

Num(Sum({<[FY]={$(vCurrentYear)}>} Cost),'$#,##0.')

We are currently in month two for our reporting calendar.  I am having trouble getting just the first two months of data for the Previous Year.  I created a field called MonthNumber that pulls the month from a date field.  I also have a field called NumberMonth that converts the MonthNumber to a standard month number starting point.  For example, our Fiscal Year starts in October, so the first MonthNumber value is 10 then 11 for November and so on.  When the value of NumberMonth equals 10, then the value of NumberMonth is 1 and so on.  

How can I write the expression for the Previous Year to give me the same month's data as the Current Year?  The variable for Previous Year is vPreviousYear.

Labels (3)
2 Replies
Brett_Bleess
Former Employee
Former Employee

Cliff, best I have is the following Design Blog post, hopefully it may provide some ideas for you:

https://community.qlik.com/t5/Qlik-Design-Blog/Year-over-Year-Comparisons/ba-p/1462927

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
Jesh19
Creator II
Creator II

Can you please post your expressions for CurrentYear and LastYear.

Below expression should work

vLastYearMonth = Month(Addyears(today(),-1)) - This should give you the same month as that of today for the last year.

 

Thanks,

Jesh