Skip to Content
Technical Articles

Last X months Trend for a given month

In this blog I would cover another usecase, where a user needs to see the last X months (say 12 months) trend. However, this last 12 months can be from the current month or a user selected month.

For implementing such a scenario in SAP Analytics Cloud, we will use the Custom Current Date capability while building the Input Control.

Step 1: Let’s first build a line chart with “Total sales” (my measure of choice) against the Order Date (my time dimension of choice). Something like below

Step 2: Now restrict the “Total Sales” Measures to “Last 12 Month Sales” by choosing the previous 12 months from current month first.

Step 3: Now, the measure is restricted for Previous Month only (As given below). We need to extend this to multiple months by changing the lookback period. And to do that click on that drop down marked in the blue box

Step 4: Changing the loop back like below to 12 would extend the range to 12 months like below. However, now they are from current month, lets address that it in next step.

Step 5: On the same dialog above change the current date option by clicking on the dropdown marked in blue in the image above and further clicking on “Create Current Date Input Control” option inside the dropdown.

Fill the values in the dialog that appears

Now, observe that the period is offset based on default date you have provided as your custom date.

Step 6: Now validate the new calculation in your line chart, by

  • dropping your actual measure and keeping just restricted measure we just created
  • and playing with the custom date input control

This way you can use custom current date option, to actually dynamically provide input to calculations.

Be the first to leave a comment
You must be Logged on to comment or reply to a post.