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

KB213146: How to get the latest N days data that are available in database in MicroStrategy Developer 9.4.1


Stefan Zepeda

Salesforce Solutions Architect • Strategy


How to get the latest N days data that are available in database in MicroStrategy Developer 9.4.1

In some scenarios, users would like to query the latest N days data that are available the database. For example, today is 10/15, the user would like to get the latest 2 days data while there is only data between 10/1~10/10 available in the database. Therefore the latest 2 days for 10/15 should be 10/9~10/10 rather than 10/14~10/15.
 
The following steps instruct how to get the latest 2 days data in the report.
 

    • Create a metric called "Metric Day" with Day attribute. Use expression: Max(Day) {~, Day}.

       
    • Create compound metric "Rank Day" with the metric generated in step1. Use expression: Rank([Metric Day])

       
    • Create report with Day attribute and add the following 2 filters:
      1)Rank Day Rank Exclude Top 1
      2)Rank Day Rank Top 3

       
    • Run report.
ka02R000000kYPzQAM_0EM440000002C7I.jpeg

Comment

0 comments

Details

Knowledge Article

Published:

June 8, 2017

Last Updated:

June 8, 2017