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

KB45111: How to filter metric values according to user login while other metrics keep available to all users in MicroStrategy Developer 9.x


Stefan Zepeda

Salesforce Solutions Architect • Strategy


How to filter metric values according to user login while other metrics keep available to all users in MicroStrategy Developer 9.x

 
In some business scenarios, it is required to filter metric values according to user login while other metrics keep available to all users. For example, values of metric  are available to all users, but User1 and User2 can only see one of the Regions, as shown below:

  • User0 can see all of the data:
ka02R000000kVK9QAM_0EM440000002Cbp.jpeg
  • User1 is only allowed to view  in Region1, but can view all values of :
ka02R000000kVK9QAM_0EM440000002Cbx.jpeg
  • User2 is only allowed to view  in Region2, but can view all values of :
ka02R000000kVK9QAM_0EM440000002Cbt.jpeg

 
Follow the steps below to achieve the requirement:

  • Structure and values of FACT_TABLE in Data Warehouse:
ka02R000000kVK9QAM_0EM440000002Cc9.jpeg
  • List of users in User Manager:
ka02R000000kVK9QAM_0EM440000002Cbj.jpeg
  • Create a new lookup table LU_USER in Data Warehouse:
ka02R000000kVK9QAM_0EM440000002Cbz.jpeg
  • Create a relationship table REL_USER_REGION to map available regions to users, as shown below:
ka02R000000kVK9QAM_0EM440000002Cbn.jpeg
  • Import the tables into the project in Strategy Developer.
  • Create a logical table FACT_JOIN_REL to join fact table and relationship table together, as shown below:
ka02R000000kVK9QAM_0EM440000002Cc0.jpeg
  • Sample Code/Error

    select t2.user_id, t1.region_id, t1.profit
    from FACT_TABLE t1
    join REL_USER_REGION t2
    on (t1.region_id = t2.region_id)


     
  • Update Schema.
  • Create attributes , , and facts , accordingly.
  • Update Schema.
  • Create a filter to get current user using system prompt 'User Login', as shown below:
ka02R000000kVK9QAM_0EM440000002Cbv.jpeg
  • Create metric based on fact without any condition.
  • Create metric based on fact with the filter in metric condition, as shown below:
ka02R000000kVK9QAM_0EM440000002Cbr.jpeg

Login as different users, and the results are as expected.
 
 
NOTE 1:
In order to display null values in the report, Outer Joins for attributes and metrics need to be enabled. Refer to following technical notes to enable outer joins:
KB3838: How to use an outer join to retrieve data when a metric on the report has a condition that is mutually exclusive with the report filter in Strategy 9.x
KB10969: How to set the default metric Join Type to Outer Join in Strategy 9.x?
KB3904: How to perform an outer join against a lookup table in Strategy 9.x
 
NOTE 2:
As user Administrator is not in the relationship table, report will not display any value for metric when Administrator is logged in, as shown below:

ka02R000000kVK9QAM_0EM440000002Cc2.jpeg

 
 
 
414384


Comment

0 comments

Details

Knowledge Article

Published:

April 11, 2017

Last Updated:

April 14, 2018