Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
chinnu123
Creator
Creator

YTD issue

Hi Team,

I am struggling to find the solution for below YTD scenario based on the Fiscal year.

My requirement is :

I have a global filter of calendar date

If user selects a date between  Jan 2019 to Dec 2019 the data should be accumulate from April 2019 to Dec 2019  

If user selects a date between  Jan 2019 to July 2020the data should be accumulate from April 2020 to July  2020.

The above scenarios is working fine for me  by applyling below expression but where I am getting issue is 

If I select April 2019 to Jan 31st  2020 In this case  the values is getting doubled.  I confused Where I am getting wrong.

can anyone help me is there anything I can change from below expression to get solution for my issue

if(Year=Year(max(CalendarDate)) and Year=Year(Min(CalendarDate)),
SUM({<CalendarDate={"<=$(=date(max(CalendarDate),'DD/MM/YYYY'))>=$(=date(min(CalendarDate),'DD/MM/YYYY'))"},Type={'product'}>} sales),
SUM({<CalendarDate={"<=$(=date(max(CalendarDate),'DD/MM/YYYY'))>=$(=Date(addmonths(yearstart(max(CalendarDate)),3),'DD/MM/YYYY'))"} , Type={'Sales'}>} sales))

Thanks,

Chinnu

Labels (2)
1 Reply
Brett_Bleess
Former Employee
Former Employee

Here is potentially another way to go at things, see the following Design Blog post:

https://community.qlik.com/t5/Qlik-Design-Blog/Fiscal-Year/ba-p/1472103

Here is one on Set Analysis as well:

https://community.qlik.com/t5/Qlik-Design-Blog/A-Primer-on-Set-Analysis/ba-p/1468344

Hopefully those may help you get things sorted out.

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.