Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Gopi_E
Creator II
Creator II

Calculate YTD and PYYTD based on current year period with takes year selections

Hi,

               I have a column like Year and Date and I want to show YTD and PY YTD. I did this Scenario, the problem was it should be showing the sales based on current year period, That means the current year sales date range is 1/1/2018 to 06/26/2018, So if I select 2017 year filter it should be showing the sales between the above date range only. Please check given excel and give some clues

my expression for getting Sales is

For Current Year:  Sum({<Year={"=$(=Max(Date))"}>}Sales)

For Previous Year : Sum({<Year={"$(=Max(Year)-1)"},Date={"<=$(=Max(Date))"}>}Sales)

2 Replies
sunny_talwar

So, if you select 2017, you would want to see 1/1/2017 to 06/28/2017 for Current Year expression or Previous Year expression?

Gopi_E
Creator II
Creator II
Author

Hi Sunny,

Sorry for late reply, Here I want to see both years based on current year YTD, For Example, if I click 2017 it will show 2017 and 2016 sales, and it should return sales between as you mentioned dates.

Thanks,

Gopi