Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
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

Labels (1)
2 Replies
vikasmahajan
MVP
MVP

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
Partner - Champion III
Partner - Champion III

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.