New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Highlighted
New Contributor

YTD vs LYTD Expression

Hi everyone,

I have been having some trouble generating an expression that outputs a percentage comparing YTD sales to LYTD sales. Currently my expression is comparing jan-dec 2016 sales to jan-sept 2017 sales, and I would like it to compare jan-sept 2016 and 2017. Please let me know if you need any clarification. My current equation is provided below.

=IF(sum( {\$<Year = {\$(#=Only(Year)-1)}>}[Total Sales])=0,'N/A', Round((sum([Total Sales])/sum( {\$<Year = {\$(#=Only(Year)-1)}>}[Total Sales])*100)-100,0.01) & '%')

Thanks!

1 Solution

Accepted Solutions

Re: YTD vs LYTD Expression

You can try below expresion.

=IF(sum( {\$<Year = {\$(#=Only(Year)-1)}>}[Total Sales])=0,'N/A', Round((sum([Total Sales])/sum( {\$<Year = {\$(#=Only(Year)-1)},Month = {"<=\$(=Max({<Year = {\$(#=Only(Year))}>}Month))"}>}[Total Sales])*100)-100,0.01) & '%')

Regards,

Kaushik Solanki

3 Replies

Re: YTD vs LYTD Expression

You can try below expresion.

=IF(sum( {\$<Year = {\$(#=Only(Year)-1)}>}[Total Sales])=0,'N/A', Round((sum([Total Sales])/sum( {\$<Year = {\$(#=Only(Year)-1)},Month = {"<=\$(=Max({<Year = {\$(#=Only(Year))}>}Month))"}>}[Total Sales])*100)-100,0.01) & '%')

Regards,

Kaushik Solanki

New Contributor

Re: YTD vs LYTD Expression

Had to change 'Month' to '[Period Num]' and it worked. Thank you!

Great.

Regards,

Kaushik Solanki