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

KB47743: How to create a metric to calculate the difference for a same metric but two different attribute elements in MicroStrategy Visual Insight?


Community Admin

• Strategy


This article describes how to create a metric to calculate differences between the same metric for different attribute element values in MicroStrategy

In order to calculate the difference for a metric Revenue between Year 2011 and 2012 in Strategy Visual Insight, MovingDifference function can be used to get the designed result.

ka04W000000Odd3QAC_0EM440000002CIN.png

MovingDifference
The function returns the moving difference between current and preceding values. The position of the preceding row used in the calculation is defined in the function arguments. The calculations can be restarted based on attributes set in the function parameters. This is an OLAP function.
 
Syntax
MovingDifference <BreakBy, SortBy> (Argument, WindowSize)
 
Where:
     •BreakBy is the attribute indicating where the calculation restarts.
     •SortBy is the attribute or metric by which the data is sorted.
     •Argument is a metric representing a list of numbers.
     •WindowSize is a positive integer indicating the range of values used to compute each difference.
 
REPRODUCING STEPS IN TUTORIAL:
     1.    Create a new derived metric called MovingDifference with the formula below:
MovingDifference<BreakBy = {Country}, SortBy = (Year)>(Revenue,2)
 
It is recommended to build the derived metric using function wizard (the “fx” button in new metric editor) as show below:
 

ka04W000000Odd3QAC_0EM440000002CIL.png

 
     2.    Add it to the grid as shown below:
 

ka04W000000Odd3QAC_0EM440000002CII.png

 
 
NOTE: All row attributes should be put into BreakBy, and Year into SortBy.


Comment

0 comments

Details

Knowledge Article

Published:

April 10, 2017

Last Updated:

April 10, 2017