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

KB5814: How to use an ApplyAggregate function to allow greater functionality in metrics created in MicroStrategy Developer 9.x


Stefan Zepeda

Salesforce Solutions Architect • Strategy


 
The ApplyAggregate, or ApplyAgg() function, can be used to bypass the SQL parser with mathematical functions.
 
EXAMPLE:
Consider a situation in which a metric must be created and that will sum values; however, it should only sum the values where an attribute tag is set to a desired value. For instance, say that there exists an attribute that lists a payment as being received, or not, and this metric should count how much money is owed.
 
It would, then, be necessary to sum all values where the payment is listed as not received, and consider the others as being equal to zero.
 
This could be achieved with an ApplyAggregate of the following structure:

ka02R000000kWytQAE_0EM440000002GDY.jpeg

ApplyAgg("sum(case when #1 in ('received') then #0 else 0 end)", , tag_attribute) {~+}
 
This Metric definition creates the following SQL:
sum(case when tag_attribute in ('received') then monetary_based_fact else 0 end)


Comment

0 comments

Details

Knowledge Article

Published:

April 12, 2017

Last Updated:

April 12, 2017