cancel
Showing results for
Did you mean:
Anonymous
Not applicable

## KPI comparison current year vs previous year

I have a small problem and I was wandering if anyone could help me. I've looked other threads, but couldn't solve it.

For selected year total sales KPI I created this expression:

Sum({\$<OrderDate.autoCalendar={Year}>}Sales)

Now I'm having trouble doing it for the previous year total sales KPI that I want to put next to the first one.

How do I do it?

1 Solution

Accepted Solutions
Creator III

Previous year:

Sum({<[OrderDate.autoCalendar.Year] = {"\$(=Max(Year(OrderDate)) - 1)"}>} Sales)

Current year:

Sum({<[OrderDate.autoCalendar.Year] = {"\$(=Max(Year(OrderDate)))"}>} Sales)

It will be based on your selection to get what is the lastest(max) possible year, and minor 1 to get its previous year.

I agree with Jerry Jackson on solution: Sum({\$<OrderDate.autoCalendar.YearsAgo={1}>}Sales)

Why dont it work?

@

7 Replies
Specialist III

Try:

Sum({\$<OrderDate.autoCalendar.YearsAgo={1}>}Sales)

Anonymous
Not applicable
Author

Thanks Jerry for the answer, but it doesn't work.

Specialist III

Prior Year:

Sum({<Year=,OrderDate={">=\$(=YearStart(MakeDate(Max(Year)),-1))<=\$(=YearEnd(MakeDate(Max(Year)),-1))"}>}Sales)

Current Year:

Sum({<Year=,OrderDate={">=\$(=YearStart(MakeDate(Max(Year))))<=\$(=YearEnd(MakeDate(Max(Year))))"}>}Sales)

Anonymous
Not applicable
Author

Thanks again Jerry, but still nothing.

Creator III

Previous year:

Sum({<[OrderDate.autoCalendar.Year] = {"\$(=Max(Year(OrderDate)) - 1)"}>} Sales)

Current year:

Sum({<[OrderDate.autoCalendar.Year] = {"\$(=Max(Year(OrderDate)))"}>} Sales)

It will be based on your selection to get what is the lastest(max) possible year, and minor 1 to get its previous year.

I agree with Jerry Jackson on solution: Sum({\$<OrderDate.autoCalendar.YearsAgo={1}>}Sales)

Why dont it work?

@

Anonymous
Not applicable
Author

Thanks Phi, your solution worked, no idea why Jerry's didnt

Thanks a lot to both of you.

Cheers

Contributor II

Hello guys,

I am solving same issue I believe, but I can't find right solution. Can you help me? . This works correctly "Sum(Invoice_item_converted_price)" if I select date Service_generated_datetime.autoCalendar.YearMonth.

I want to show in table also previous year sales for selected YearMonth, but it doesn't work

Sum({<[Service_generated_datetime.autoCalendar.Year] = {"\$(=Max(Year(Service_generated_datetime))-1)"}>} Invoice_item_converted_price)