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: 
GaneshLakshman
Contributor III
Contributor III

YTD Values

Hi,

I have a data model that uses canonical dates as shown in the attached file.

But I have a problem after implementing it.

I'm trying to get the numbers for previous year same date but I get zero, not sure if doing it right. I guess it doesn't get the values for previous year as the current year is selected. 

Is there a way to get the corresponding value of the same day previous year?

ex: if leads =20 on 10-sep-2018, leads = ?? on 10-sep-2017

Here is the expression i have used:

This current date works:

sum({<DateType={"LeadMarketCreatedDate"}, Date={">=$(vDateFrom) <=$(vDateTo)"}>} LeadFlag)

But this doesn't work:

=sum({<DateType={"LeadMarketCreatedDate"}, Date={">=$(vDateFrom_1) <=$(vDateTo_1)"}>} LeadFlag)

 

vDateFrom_1 is:  num((Date(AddYears(min(Date), -1))))

vDateTo_1 is:  num((Date(AddYears(max(Date), -1))))

Help is greatly appreciated

2 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Just one check, you should neglect all the Calendar Related fields in set analysis while trying to get the previous year data with current years selection.

Do in your case the expression should look like below.

=sum({<DateType={"LeadMarketCreatedDate"}, Date={">=$(vDateFrom_1) <=$(vDateTo_1)"},Year=,Month=,Week=>} LeadFlag)

Replace the Bold Field names with your actual field names.

 

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
GaneshLakshman
Contributor III
Contributor III
Author

This unfortunately did not work, I guess when we select today's date it gets the data only of today which makes it impossible to refer to previous years data.
Is there a way to disregard the selected data but consider the date selected so that we can go the Today-1?