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

Previous12 and Rolling12

Hi ,

I have posted a query w.r.t this topic already, but still unable to differentiate between these 2:

Ex Scenario:

I have data for 2015,2016,2017 (Jan till Dec for all years).  i need to compare in a bar chart the Rolling12 months sales to Previous12months sales.

For rolling12 months i used the below in expression:

=Sum({<Date={"$(='>=' & Date(MonthStart(Max(Date), -13)) & '<' & Date(MonthStart(Max(Date))))"}>} Sales)

or

PeriodID = {">=$(=Max(PeriodID)-11)<=$(=Max(PeriodID))"}

This is resulting in Rolling 12 months. Like 2017 Jan Till Dec sales.

If i want to calculate the previous12 months will it be like : present month April 2018 back 12 months which is May 2017 Till April 2018, is my assumption correct or not?

Can any one please suggest a code to calculate previous12months, i worked out with almost all links provided in community, i can see Rolling12months but not Previous12months. 

Can i get a response on my scenario please?

2 Replies
MK_QSL
MVP
MVP

Considering you have Master Calendar and YearMonth (I am assuming OrderYearMonth) field available..

You first have to do something like below in script.

Period:

Load

Date(FieldValue('OrderYearMonth',RecNo()),'YYYYMM') as OrderYearMonth

AutoGenerate FieldValueCount('OrderYearMonth');

AsOfPeriodTable:

Load

OrderYearMonth as AsOfPeriod

,'Rolling 12' as PeriodType

,Date(AddMonths(OrderYearMonth,1-IterNo()),'YYYYMM') as OrderYearMonth

Resident Period

While IterNo() <= 12;

Drop Table Period;

Now at front end, use below

Dimension

AsOfPeriod


Experession

SUM({<AsOfPeriod = {">=$(=Date(AddMonths(Max(AsOfPeriod),-11),'YYYYMM'))<=$(=Max(AsOfPeriod))"}>}Sales)

This will give you Total Sales for Last 12 Months..

Each month will be representing TotalSales of Rolling 12 Months.

vikasmahajan

Hi Manish,

This is will give you rolling 12 months sale , any thought  if  I want to calculate previous 12 rolling months ? 

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.