Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
akpofureenughwu
Creator III
Creator III

Previous Year Vs Current Year Sales figure

Good day everyone,

I have a set of data in this form

S/NProductActualTargetDateContract Type
1Soap40050001/01/2016SB
2Rice50001000001/01/2016SB
3Soap67080001/01/2017JB
4Soap1300200001/06/2016SB
5Rice1400300001/06/2017JB

In my attempt to show sales for all products for the current year and previous year.. I used these expressions:

Sum({<Year = {"$(=Max(Year))"}, Year >} Actual ) and Sum({<Year = {"$(=Max(Year)-1)"}, Year >} Actual) but my result is showing the same value?

I also used this expression Max(Aggr(Sum(Actual), Date)) to show the maximum actual sales values. It worked but I need to narrow it down to particular products like max actual sales for soap only?

Please can you help me review the expressions?

Regards

5 Replies
its_anandrjs

Remove Year field from expression.

Sum({<Year = {"$(=Max(Year))"} >} Actual )

and

Sum({<Year = {"$(=Max(Year)-1)"} >} Actual)

Anil_Babu_Samineni

Are you going to ignore the Year selection in analysis?

Sum({<Year = {"=Only({$<Year=>} Year) = $(=Max(Year))"}, Year >} Actual )

Sum({<Year = {"=Only({$<Year=>} Year) = $(=Max(Year)-1)"}, Year >} Actual)


And Here we go for restrict the data to only one Product

Max(Aggr(Sum({<Product = {"Soap"}, Year=>} Actual), Date))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
akpofureenughwu
Creator III
Creator III
Author

Hello Anil

I am using the year selection.

load*,

'Q'&ceil(month(date#([Month],'MMM'))/3) as [Quarter],

'Day '&Day("Date")&' '&Month as [Day Number];

load*,

Year("Date") as Year,

Month("Date") as Month,

Day("Date") as Day;

I used the above script to convert date into year

Anil_Babu_Samineni

That is what my expression do, Here, Year can exclude the selection for analysis.

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
its_anandrjs

Find the atatched and have a look on the expressions on the chart.