Skip to main content
cancel
Showing results for 
Search instead 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
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

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!

View solution in original post

3 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

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!

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Great.

Regards,

Kaushik Solanki

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