Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
CUSTOMERS ONLY: Now accepting customer applications for the 2023 Luminary Program: SUBMIT NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
bradmahan
Contributor
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
kaushiknsolanki

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

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".

View solution in original post

3 Replies
kaushiknsolanki

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

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".
bradmahan
Contributor
Contributor
Author

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

kaushiknsolanki

Great.

Regards,

Kaushik Solanki

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".