Rolling periods

Rolling period and trailing average measures are also very common in datasets, as they help to smooth out individual outliers and analyze longer-term trends. For example, a significant business event or variance 10 months ago will have a relatively small impact on a trailing 12 month total. Additionally, this variance will not impact trailing 30 day or 3, 6, and 9-month rolling period measures.

The following two measures capture the trailing 60 days of sales history and the 60 days of history prior to the trailing 60 days:

Internet Net Sales (Trailing 60 Days) = 
VAR MaxDate = MAX('Date'[Date])
VAR StartDate = MaxDate - 59
RETURN
CALCULATE([Internet Net Sales],FILTER(ALL('Date'),'Date'[Date] >= StartDate && 'Date'[Date] <= MaxDate))

Internet Net Sales Trailing (60 to 120 Days) =
VAR MaxDate = MAX('Date'[Date])
VAR EndDate = MaxDate - 60
VAR StartDate = EndDate - 59
RETURN
CALCULATE([Internet Net Sales],FILTER(ALL('Date'), 'Date'[Date] >= StartDate && 'Date'[Date] <= EndDate))

The two 60-day measures compute the dates for the filter condition within DAX variables and then pass these values into the FILTER() function. The two measures help to answer the question "Is Internet sales growth accelerating?". The following table visual in Power BI Desktop displays the measures by date and as a subtotal value:

Trailing 60 and 60 to 120-day measures

With this logic, the value for the trailing 60 days measure on November 15th, 2017 includes Internet sales since September 17th, 2017. The 60 to 120 days measure, however, includes sales history from July 19th, 2017 through September 16th, 2017. The subtotal value reflects the latest date in the filter context—November 15th, 2017, in this example.

Rolling period or trailing average measures generally require the sequential numeric date dimension columns in the date suggested in both previous chapters. Very similar to the prior period measures from the previous section (for example, PY YTD), rolling period measures can reference sequential columns for the given granularity and modify the date filter by adding or subtracting values. 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.46.78