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

KB251334: SQL Engine intersects multiple custom groups in the final pass of a report SQL in MicroStrategy 9.x-10.x


Community Admin

• Strategy


SUMMARY
This symptom has been classified as a designed behavior by Strategy. The impact is limited to Strategy reports using multiple custom groups. A workaround is available in the current document.”
SYMPTOM
In a Strategy report, it is seen that the custom group passes union instead of intersect.
STEPS TO REPRODUCE
The steps below are based on the Strategy Tutorial project: 

  • Create one metric called CC with the definition of “Count<Distinct=True>(Customer) {~}”
  • Create one custom group called CG1 with one custom group element, using set qualification of  the definition of “Rank of Revenue' Top 10 and output level is Set of Customer” as shown below:
ka04W000000OcaCQAS_0EM440000002C53.jpeg
  • Create another custom group called CG2 also with one custom group element, using set qualification of  the definition of “Rank of ‘Profit’ Top 10 and output level is Set of Customer” as shown below:
ka04W000000OcaCQAS_0EM440000002C51.jpeg
  • Create a report with attribute Year, metric CC and above two custom groups.
  • Execute the report, and notice in the final pass, two custom group results are being intersected:  


select      a12.YEAR_ID  YEAR_ID,
                count(distinct a11.CUSTOMER_ID)  WJXBFS1
from         LU_CUSTOMER    a11
                cross join                LU_YEAR                a12
where      (a11.CUSTOMER_ID,
                a12.YEAR_ID)
in            (((select  ps21.CUSTOMER_ID,
                                ps21.YEAR_ID
                from         ZZMQ01 ps21
                where      ps21.GODWFLAG2_1 = 1)
intersect (select ps21.CUSTOMER_ID,
                                ps21.YEAR_ID
                from         ZZMQ01 ps21
                where      ps21.GODWFLAG4_1 = 1)))
group by  a12.YEAR_ID

CAUSE
This is working as designed. Custom groups are lists of filters. When two custom groups are on a report, the SQL engine needs to meet both CG1 conditions and CG2 conditions, thus an intersect is issued to merge the 2 conditions. 
ACTION
There is no action needed as this is working as designed. 
 
WORKAROUND

  • Create one custom group with two filters in one element and use “OR” as shown below:
ka04W000000OcaCQAS_0EM440000002C4y.jpeg
  • Notice for the final pass report SQL now uses a “union”:


select     a12.YEAR_ID  YEAR_ID,
                count(distinct a11.CUSTOMER_ID)  WJXBFS1
from       LU_CUSTOMER     a11
                cross join               LU_YEAR                a12
where    (a11.CUSTOMER_ID,
                a12.YEAR_ID)
in            (((select ps21.CUSTOMER_ID,
                                ps21.YEAR_ID
                from       ZZMQ01 ps21
                where    ps21.GODWFLAG2_1 = 1)
union (select        ps21.CUSTOMER_ID,
                                ps21.YEAR_ID
                from       ZZMQ01 ps21
                where    ps21.GODWFLAG4_1 = 1)))
group by                a12.YEAR_ID

 
The Strategy Internal Reference Number for the issue discussed in this technical note is 777562.
 


Comment

0 comments

Details

Knowledge Article

Published:

May 9, 2017

Last Updated:

May 9, 2017