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

KB419483: How to create a comparison operator prompt and use it in an applysimple function in MicroStrategy Developer


Stefan Zepeda

Salesforce Solutions Architect • Strategy


How to create a comparison operator prompt and use it in an applysimple function in MicroStrategy Developer

Object prompts can be created using comparison operators. Perform the following steps to achieve this:

  • Go to File > New > Prompt to open 'Prompt Generation Wizard':
ka044000000kUGYAA2_0EM440000002FxJ.gif
  • Select 'Object Prompt' in 'Prompt Generation Wizard' and click 'Next', as shown below:
ka044000000kUGYAA2_0EM440000002Fwz.gif
  • Click 'Add' and move the comparison operators in Schema object > Functions and Operators > Operators > Comparison Operators from 'Available objects' to 'Selected objects' area in 'Select Objects' window:
ka044000000kUGYAA2_0EM440000002FxL.gif
  • Alternatively, create a search object that returns the list of comparison operators.
     
  • Click 'Finish' and save the prompt.

Comparison operator prompts can be used in ApplySimple functions with Case statements using the metric, (@nameofprompt(M1, M2)). The following steps demonstrate how to use the comparison operator prompt in an ApplySimple function with a Case statement.
 

  • Create a metric with the following definition:
    M1 = @ComparisonOperator([Metric 1], [Metric 2])
  • NOTES:
    • Drag and drop the comparison operator prompt into the Metric definition to create the @ComparisonOperator portion.
    • Metric 1 and Metric 2and are existing metrics.
  • Create a metric with an applysimple function, Case statement, and the above metric, M1:
    M2 = ApplySimple("Case when #0 THEN 1 ELSE 0 END ", [M1])
  • Add the metric M2 to the report. This will allow users to select a comparison operator for the Case Statement:
ka044000000kUGYAA2_0EM440000002FxH.gif

The report displays the result according to the comparison operator that the user selected:
 

ka044000000kUGYAA2_0EM440000002FxI.gif

 
This example is the result with comparison operator, '<'. In every row, Revenue is greater than Cost, so the statement 'Revenue < Cost' is false. Therefore, M2 shows 0 for all rows.
 
KB419483


Comment

0 comments

Details

Knowledge Article

Published:

June 13, 2017

Last Updated:

March 28, 2019