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

KB17107: How to create a metric that compares the report date with the selected date and display relevant string value based on the results of the comparison in MicroStrategy Developer 9.4.x-10.x


Stefan Zepeda

Salesforce Solutions Architect • Strategy


This article explains how to create a metric that displays 'NEW' when the display date is later or equal to the selected date and 'OLD' when the display date is earlier than the selected date in MicroStrategy Developer 9.4.x-10.x

Users may want to create a metric that displays 'NEW' when the display date is later or equal to the selected date and 'OLD' when the display date is earlier than the selected date in Strategy Developer 9.4.x-10.x. To do this, follow the steps below:
 

  • Create a new attribute named attributeA that points to the column of the datestamp in the warehouse using the following formula:
    >(((Year() * 10000) + (Month() * 100)) + DayOfMonth())
  • This will display the date 1/12/2017 as 20171201.
     
  • Create a metric named metricB that will create a sum of attributeA:
    Sum()
  • Create a date value prompt named promptC.
     
  • Create a metric named metricD that converts the prompt answers from promptC to the format similar to metricB:
    Sum(((Year(? ) * 10000) + (Month(? ) * 100)) + DayOfMonth(? )
  • Create another metric named DateDifference that compares the value from the two metrics and sets the value to 'NEW' or 'OLD' with the following formula:
    IF((MetricB >= MetricD), "NEW", "OLD")
  • Create a report with the Day attribute on the column and the DateDifference metric on the row. The result is as follows for prompt answer = '1/12/2003':
ka02R000000kcP1QAI_0EM440000002F4e.jpeg

Comment

0 comments

Details

Knowledge Article

Published:

April 27, 2017

Last Updated:

April 27, 2017