Skip to main content
Announcements
The way to achieve your own success is the willingness to help somebody else. Go for it!
cancel
Showing results for 
Search instead for 
Did you mean: 
ShellyG
Creator
Creator

YTD Comparison

Hi everyone,

I need help with the following:

I need to do an YTD comparison in Qlik Sense. So far I have created a flag for the current year and the previous year and using the flag I am comparing the current year sales with the previous one. If I select  specific dates it will work again.

Now my question is the following - I have full 2020 data but for 2021 I have until the last day of the previous month (30th of October) so if I compare 2021 with 2020, I am actually comparing unfinished year (2021) with a finished one (2020) and this should not be the case. 

How can I make Qlik understand that I want to compare the current year with the previous year, but only until the date I have available for the current year (in this case 30th of October). 

Any ideas will be helpful! Thanks!

2 Replies
canerkan
Partner - Creator III
Partner - Creator III

Hi ShellyG,

how do you want to display this comparison? In a straight Table, in a Bar Chart or a Line Chart?

To get the same date for last year you could use the MakeDate Function like this:

MakeDate(Year(Today()-1) to get the first day of last year and MonthEnd(MakeDate(Year(Today())-1,Month(Today())-1, 1)) to get the last day of your previous month in last year.

You can put each formula in a variable and use them in your calculations.

Hope this helps,

Can

ShellyG
Creator
Creator
Author

Hi Can,

Thanks for your reply! 

This would work, but unfortunately not fully as I am comparing fiscal periods, which means that in these cases 15th of November this year, might not be the same as 15th of November last year. 

Best Regards,

Shelly