Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
AH
Creator III
Creator III

Previous year-month and Previous Year-QTD calculation

I am trying to calculate Current year & previous year amount. Please take a look at the calculation and suggest. I would really appreciate your help.


=num((Sum({<SalesItemID={'A','B'},[Invoice Year] = {'$(=Max([Invoice Year]))'}>}[Invoice Units])),'##,##0')----Current Year. which is 2015 now

=num((Sum({<SalesItemID={'A','B'},[Invoice Year] = {'$(=Max([Invoice Year]-1))'}>}[Invoice Units])),'##,##0')----Previous Year. Which is for my case 2014


Now I want to calculate Current month for 2015 which is,
=num((Sum({<SalesItemID={'A','B'},[Invoice Month] = {'$(=Max([Invoice Month]))'}>}[Invoice Units])),'##,##0')----Current month for 2015

What would be the calculation for Current month for 2014?


Also,

I would like to calculate Quarter to date for Year 2015 which is,
=num((Sum({<SalesItemID={'A','B'},[Invoice Quarter] = {'$(=Max([Invoice Quarter]))'}>}[Invoice Units])),'##,##0')----Quarter to date for 2015

What would be the calculation for Quarter To Date for Previous year 2014? Mean the same quarter as of 2015 for the previous year.


Could you please give me some feedback?

Also comment on calculation i have mentioned here.

11 Replies
Gysbert_Wassenaar

Yes. Something like this:

dual( 'Q' & ceil(month([Invoice Date])/3),  ceil(month([Invoice Date])/3)) as [Invoice Quarter]


talk is cheap, supply exceeds demand
AH
Creator III
Creator III
Author

Hi Gysbert,

Havent got Luck with using the expression yet.

Thanks,

Shan