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

YTD based on the selection

Hi all ,

I want to be able to compare last years data and this years data based on current selections.  Meaning that if I select 2013 and February, I will compare January + February this year against January and February last Year.

Can anyone tell what is the expression for this?

Thanks in advance,

Soumya

2 Replies
vikasmahajan

PFA sample will help you to arrive the same.

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

For Current Year

=Sum({$<YearDimensionName=, MonthDimensionName= QuarterDimensionName=, DateDimensionName={'>=$(=Year(Max(DateDimensionName)))<=$(=Date(Max(DateDimensionName)))'}>}SALES_VALUE)

For previous year

Sum({$<YearDimensionName=, MonthDimensionName= QuarterDimensionName=, DateDimensionName={'>=$(=YearStart(Max(DateDimensionName), -1))<=$(=AddYears(Max(DateDimensionName), -1))'}>}SALES_VALUE)


Regards,

Jagan.