Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Showing previous months sales - Set Analysis.

Hi there,


Trying to get my previous sales from last month subtracted from the current sales this month, so it shows the amount of sales (less or more) than the previous.


My current set analysis:

Count({<Month={">=$(=MonthStart(AddMonths(Max(Month),-1))) $(=MonthStart(AddMonths(Max(Month),0)))"}>}Sales_total)


This giving the wrong result, obviously. Not too sure how to structure my analysis. Any assistance would help.


Thanks.

20 Replies
sunny_talwar

Where are you trying to do this? In a text box object or a chart? If in a chart is your dimension Month (or some date time related dimension?)

Not applicable
Author

Hi,

Trying to do this in a KPI.

The date (month) is a dimension.

jayaseelan
Creator III
Creator III

Are you trying to count the Sales_Total?

Anonymous
Not applicable
Author

Hi

try this

Count({<Month={">=$(=MonthStart(AddMonths(Max(Month),-1))) $(=MonthEnd(AddMonths(Max(Month),0)))"}>}Sales_total)



or


count({<Month={">=$('>=' & MonthStart(AddMonths(Max(Month),-1)))&'<='& MonthEnd(AddMonths(Max(Month),0))"} Sales_total)

Not applicable
Author

if the data type of Month field is dual  type (string and integer) use below expression

sum({<Month = { $(=month( MakeDate(1999, max(Month)  ,1) ) ) }>} Sales_total) - sum({<Month = { $(=month( MakeDate(1999,( max(Month) - 1 ) ,1) ) ) }>} Sales_total)

and if Month field is already an integer, you can use below

sum({<Month = { $(=max(Month)) }>} Sales_total) - sum({<Month = { $(=max(Month)-1) }>} Sales_total)

regards,

sunny_talwar

What is the month's field format?? Try this:

Count({<Month={"$(='>=' & Date(MonthStart(Max(Month),-1)), 'DateFieldFormatHere') & '<' & Date(MonthStart(Max(Month),0), 'DateFieldFormatHere'))"}>} Sales_total)

Not applicable
Author

Hi,


No I already have a COUNT of sales using the current expression:

COUNT({$<Sales_total={">0"}>}  Sales_Total)

The dimension drives the months when selected.

Trying to do it when Month (June) - (May) gives a remainder of what the difference is (+ OR -).

Thanks.

Not applicable
Author

YYYY-MM

(2016/05)*

Anonymous
Not applicable
Author

Count({<Month={"$(=MonthStart(AddMonths(Max(Month),-1)))Sales_total)  //This will give your a count of last month

-

Count({<Month={"$(=MonthStart(Max(Month))Sales_total)     //This will give you a count of this month

//Subtraction will give a variance result