EducationSoftwareStrategy.com
StrategyCommunity

Knowledge Base

Product

Community

Knowledge Base

TopicsBrowse ArticlesDeveloper Zone

Product

Download SoftwareProduct DocumentationSecurity Hub

Education

Tutorial VideosSolution GalleryEducation courses

Community

GuidelinesGrandmastersEvents
x_social-icon_white.svglinkedin_social-icon_white.svg
Strategy logoCommunity

© Strategy Inc. All Rights Reserved.

LegalTerms of UsePrivacy Policy
  1. Home
  2. Topics

KB46481: How to create a document that shows the rolling last 12 months on a grid or graph based on a selector in MicroStrategy.


Stefan Zepeda

Salesforce Solutions Architect • Strategy


This article describes how to create a document with rolling last 12 months using a selector

In some situations, it may be useful to display a graph with the last 12 months of data that will adjust depending on which month is chosen. This article describes a method for creating an additional attribute that allows users to use a selector on a document that can display the previous rolling 12 months.
1. Create a logical table to serve as the lookup table for the "Rolling Month" attribute. Use the following SQL statement as an example to define the lookup table:


SELECT

MONTH_ID AS ROLL_MONTH_ID,

MONTH_DESC AS ROLL_MONTH_DESC

FROM

LU_MONTH

 
Define the following Column Objects:
ROLL_MONTH_ID             Integer  
ROLL_MONTH_DESC      VarChar
(Note: both of these column objects should be added as new columns.)
 
Here is an example of the table definition:

ka02R000000kX1eQAE_0EM440000002CQk.png

 
2. Create a logical table that describes the relationship between Rolling Month and Month


SELECT

a.MONTH_ID,

b.ROLL_MONTH_ID

FROM

LU_MONTH a,

(SELECT MONTH_ID AS ROLL_MONTH_ID FROM LU_MONTH) b

WHERE ROLL_MONTH_ID >= MONTH_ID and ROLL_MONTH_ID < MONTH_ID + 100

 
Define the following Column Objects:
MONTH_ID                  Integer  
ROLL_MONTH_ID     Integer
 
Both of these columns should be mapped as existing columns by dragging in the ID columns from their respective lookup tables. This will ensure that no duplicate columns are created.
  

ka02R000000kX1eQAE_0EM440000002CQb.png

 
3. Create an attribute called Rolling Month based on the lookup and relationship tables that were just defined. The attribute should have an ID form based on ROLL_MONTH_ID and the description form based on ROLL_MONTH_DESC. The ID should be mapped to both the lookup table and the relationship table.  

ka02R000000kX1eQAE_0EM440000002CQh.png

4. Adjust the Month attribute so that it maps to the REL_ROLL_MONTH table. Then add Rolling Month as a parent to the attribute. Set the relationship to many-to-many and the relationship table to REL_ROLL_MONTH. Once changes are made to the attributes, update the schema. 
 

ka02R000000kX1eQAE_0EM440000002CQZ.png

5. Now, on any dataset that will use the Rolling Month selector, add both Month and Rolling Month to the dataset.
6. On the document, create a selector based on the Rolling Month attribute and target any graph that will display the last 12 rolling months. When any month is selected in the Rolling Month selector, the graph will show that month and the previous 12 months.
 
             

ka02R000000kX1eQAE_0EM440000002CQj.png

Optional: If any other grids/graphs should only show one value based on the Rolling Month selector, add a view filter to the report where Month and Rolling Month are the same. For example, the following syntax works with the above method:
Month ID Equals Rolling Month ID
Note: the method described in this article assumes that the data model is set up similar to Strategy Tutorial. The logical table SQL may need to be adjusted depending on the setup of the Month ID, the number of months to show, etc.


Comment

0 comments

Details

Knowledge Article

Published:

April 11, 2017

Last Updated:

April 11, 2017