Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
pauldamen
Partner - Creator II
Partner - Creator II

Compare to last year in table

Hello all,

I probably have a pretty simple question but I can' figure it out. I have a simple table in which I have several figures which are calculated like this:

=sum({<cost_center_function = {'Sales'}> [Amount_actual] ).

Which in this case gives me the sales amount. Now I want to add a column with previous year. So if I select 2012 I automatically want to see 2011 in that column the same if I select 1 month, so if I select jan 2012, I automatically want to see jan 2011 etc.

I tried things like month-12 etc. but that doesn't work.

Hope you guys can help me!

Regards,

Paul

17 Replies
pauldamen
Partner - Creator II
Partner - Creator II
Author

Now it changes but gives the same number as the current selection so not the same selection but a year ago.

v_iyyappan
Specialist
Specialist

Hi,

     can u please attach ur file.

Regards,

Iyyappan.

pauldamen
Partner - Creator II
Partner - Creator II
Author

Sorry I can't attach the file. Classified info...

pauldamen
Partner - Creator II
Partner - Creator II
Author

Hi,

Any thoughts why it now only shows me the same period (so not a year back)?

Appreciate your help!

Regards,

Paul

jagan
Luminary Alumni
Luminary Alumni

Hi,

This will show the Previous Year value, because we are using "AddYears((SetDate),-1))", this will get you the previous years data.

=Sum({<costcenter= {'Sales'},SetDate={">=$(=MonthStart(AddYears((SetDate),-1))) <$(=MonthEnd(AddYears((SetDate),-1)))"}>}[amount_actual])

This expression is used for current year data

=Sum({<costcenter= {'Sales'},SetDate={">=$(=MonthStart((SetDate))) <$(=MonthEnd((SetDate)))"}>}[amount_actual])

Hope this helps you.

Regards,

Jagan.

pauldamen
Partner - Creator II
Partner - Creator II
Author

Hi,

Thanks again for all your help. But it still returns the same numbers in each column, so still not looking a year back....

jagan
Luminary Alumni
Luminary Alumni

Hi,

Can you attach the sample file with sample data. It would be helpful in understanding the problem.

Regards,

Jagan.

pauldamen
Partner - Creator II
Partner - Creator II
Author

I figured it out! Was something in my date table why it wasn't going correctly, but I solved it by adding an other variable.

Thanks a lot for your help!