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

KB6072: The filter is ignored when running a report containing the count metric of an attribute that has a fact table as its lookup table


Community Admin

• Strategy


 
SYMPTOM:
In Strategy Product Suite, it is possible to define an attribute that has a fact table as its lookup table. For example, consider the following attribute:

ka04W000000ObxsQAC_0EM440000002GDF.gif

 
Note that the YR_CATEGORY_SLS fact table is used as lookup table for this attribute.

ka04W000000ObxsQAC_0EM440000002GCo.gif

 
Users can, then, create a count metric based on such an attribute. In this example, a metric with the following formula can be created:
Count(Category)

ka04W000000ObxsQAC_0EM440000002GCu.gif

 
When users create a report that includes the metric mentioned above, along with a filter on an attribute that does not belong to the same dimension as the attribute in the count metric, the filter is ignored:
 
Filter: Year In (1998)
Metric: Count(Category)

ka04W000000ObxsQAC_0EM440000002GD0.gif

 
In this report, the 'Year' attribute belongs to a different dimension than the 'Category' attribute. The SQL for the report shown in the previous image is shown below:
select count(a11.) as COUNTCATEGOR
from a11

ka04W000000ObxsQAC_0EM440000002GCk.gif

 
CAUSE:
By default, metrics that count attribute elements will access the lookup table for the attribute.
Since the attribute in the count metric and the attribute in the filter come from different dimensions, the Strategy SQL Generation Engine assumes that the lookup table for either attribute will not have a reference to the other attribute, even if it is a fact table and it does include a reference to both attributes. Therefore, to avoid a possible Cartesian join, the filter is ignored.
 
 
ACTION:
To avoid this scenario, users should configure the 'Fact ID' parameter under the 'Count Parameters' option for the count metric:

  • Open the Metric Editor.
  • Highlight the word 'Count' and right-click on it. The following menu appears:
ka04W000000ObxsQAC_0EM440000002GCz.gif
  • Click on the 'Count parameters' option. The following menu appears:
ka04W000000ObxsQAC_0EM440000002GCs.gif
  • Open the 'FactID' pull down menu and select any of the facts that exist in the lookup table for the attribute that is being counted (refer to the image of the YR_CATEGORY_SLS table editor above)
ka04W000000ObxsQAC_0EM440000002GCq.gif
  • Click on the 'OK' button. The metric editor now shows information about the fact selected in the 'Count parameters' window.
ka04W000000ObxsQAC_0EM440000002GCx.gif

 
The report now includes the filter in the SQL:
select count(a11.) as COUNTCATEGOR
from a11
where a11. in (1998)

ka04W000000ObxsQAC_0EM440000002GCm.gif

 
When users specify the 'FactID', the SQL Generation Engine assumes that users want to calculate the count metric against a fact table. As a result, it includes the filter condition in the SQL.
 
 
 
 
 
 
 
 
 
 
 


Comment

0 comments

Details

Knowledge Article

Published:

May 31, 2017

Last Updated:

May 31, 2017