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

Last month sales

How to calculate the last month sales values?

Eg:

=Sum({$<Year={$(=Max(Year))},MonthID={$(=Max(MonthID))}>}PrimarySales)

this above expression is currents month sales 

7 Replies
amit_saini
Master III
Master III

Stephan ,

See the attachment.

Thanks,

AS

jagan
Luminary Alumni
Luminary Alumni

Hi,

If you have date field try like this

=Sum({$<Year=,MonthID=, DateDimensionName={'>=$(=MonthStart(Max(DateDimensionName), -1))<=$(=MonthEnd(Max(DateDimensionName), -1))'}>} PrimarySales)


Hope this helps you.


Regards,

Jagan.

stephenedberkg
Creator II
Creator II
Author

Dears,

   =Sum({$<Year={$(=Max(Year))},MonthID={$(=Max(MonthID-1))}>}Sales)

this above expression is correct or wrong for the last month sales

jagan
Luminary Alumni
Luminary Alumni

Hi,

Let us assume if you select 2014 and Month as january then your expression will return

Null value because 1(Jan) - 1 gives you zero.

Hope this helps you.

Regards,

Jagan.

stephenedberkg
Creator II
Creator II
Author

Re: Last month sales

Dear jagan

  This kind of situation how to take the 2013 Dec values?

Regards,

Stephen Edberk

jagan
Luminary Alumni
Luminary Alumni

Hi,

If you don't have date field then arrive the date field in script like below

LOAD

*,

MakeDate(Year, MonthID) AS DateDimensionName

FROM DataSource;


Now use below expression for getting the last month sales


=Sum({$<Year=,MonthID=, DateDimensionName={'>=$(=MonthStart(Max(DateDimensionName), -1))<=$(=MonthEnd(Max(DateDimensionName), -1))'}>} PrimarySales)


Hope this helps you.


Regards,

Jagan.