Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for
Did you mean:
Anonymous
Not applicable

## 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

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

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
3 Replies

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

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Anonymous
Not applicable
Author

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