In my last blog post, I blogged about the new MicroStrategy Community. Jaime Perez, VP of Worldwide Customer Services, and his crew have come up with a better way for us to engage with MicroStrategy as well as his team.
Speaking of Jaime, last June, he posted this great tip on the MicroStrategy Knowledgebase site as a TechNote. I am reblogging it since it is one of the most frequent questions I get asked and I find it an extremely useful Tip & Trick. Also, this will give you an idea of the great stuff being posted in the MicroStrategy Community.
MicroStrategy and Cross Joins
In some scenarios, one may encounter cross joins in the SQL View of a standard, SQL Report in MicroStrategy. Cross joins appear when two tables do not have any common key attributes between them in which they can inner join. As a result, the two tables essentially combine together to create one table that has all the data from both tables, but this results in poorer performance with a common effect of increased execution times. Sometimes these execution times, and performance hits, can be very severe. Therefore, it is important to understand some simple steps that can be performed to resolve a cross join, as well as some steps to understand why it may be appearing in the SQL View of the report.
One common occurrence of a cross join is when a report contains at least two unrelated attributes in the grid, and no metrics are present in order to relate the unrelated attributes via a fact table. Such a occurrence can be resolved in a few ways:
- Create a relationship filter, set the output level as the unrelated attributes (or the entire report level), and then relate these by a Logical Table object
- Create a relationship filter, set the output level as the unrelated attributes (or the entire report level), and then relate these by a Fact object
- Add a metric to the report that uses a fact from a table in which both attributes can inner join to
This provides a pathway from the fact table to the lookup tables in which the unrelated attributes are sourced from. The result is an inner join between the fact table and the lookup tables, which resolves the cross join between the two unrelated lookup tables.
Options 1 and 2 provide a means in which the report template can remain as only attributes, whereas Option 3 would have a metric on the report. Option 3 may not be desired if a metric does not want to be placed on the report. Keep in mind that other techniques can also be employed to have the metric on the report, but formatted to be hidden from display.
More common scenarios include cross joins between a fact table and a lookup table, and are typically surprising to a developer. These situations can be a bit more tricky to troubleshoot and resolve, but here are a few techniques that can be employed to try to resolve the issue:
- In SQL View look at where the cross join appears, and between which tables the cross join appears
- Open up those tables in the Table Editor by navigating to the Schema Objects\Tables folder, and double-clicking the tables
- Select the Logical View Tab of both tables to see all the logical objects mapped to the table
- Take note of which attributes have a key icon beside them
- These key attributes denote attributes at the lowest level of their hierarchy presently mapped to the table and/or attributes that are in their own hierarchy (meaning they have no parents or children)
- The SQL Engine will join 2 tables on common key attributes only, so if none of the key attributes on either table exist on both tables, then a cross join should appear
This means that just because a Region attribute exists on Table_A and a Region attribute exists on Table_B does not necessarily mean that the SQL Engine will join on Region. If Region has its child attribute on the table, then that attribute should be the key as it is the lowest level attribute of its particular hierarchy mapped to the table. If Region exists on both tables, and is also a key attribute on both tables, then an inner join should take place on Region.
This essentially means that one can find a cross join, investigate the tables in which it appears, and verify if at least 1 common key attribute exists between the tables. If not, then that should be the first path to investigate because a cross join is correct in that scenario.
You can find a detailed video on how this issue is reproduced and resolved here: Tech Note 71019 . Steps to reproduce and resolve
MicroStrategy Technical Support can assist with resolving cross joins in a specific report, however caution should be taken when resolving such issues. In some scenarios, the cross join is resolved through modifications to the schema objects, which can have a ripple effect to all other reports in an environment. For example, if a relationship is changed in the Region attribute to resolve a cross join in one report, this change will be reflected in all other reports that use Region, and potentially the hierarchy in which Region belongs. As a result, the SQL View of one report will have the cross join resolved, but the SQL may have changed in other reports using Region or its related attributes. This may or may not be desired. MicroStrategy Technical Support may not be able to fully understand the impact of such a schema change to the data model, so before a change is made to the data model the consequences of such a change should be fully understood by the developer, and any changes made to the schema should be recorded.
 Jaime Perez, TN47356: How to troubleshoot cross joins in SQL Reports for the SQL Generation Engine 9.x, MicroStrategy Community, 06/24/2014, http://community.microstrategy.com/t5/Architect/TN47356-How-to-troubleshoot-cross-joins-in-SQL-Reports-for-the/ta-p/196989.
 MicroStrrategy Knowledgebase, Tech Note 71019 . Steps to reproduce and resolve,
Tips & Tricks #9: How Do Changes on the Source Report (Dataset) Get Reflected in MicroStrategy Report Services 9.x Documents
In MicroStrategy Report Services Documents, document datasets and their original source reports (such as a grid report being used as a dataset) are not completely connected to each other. Depending on the changes made on the source report, it can be reflected differently on the document. Basically, the change can be divided into two types.
Type 1 – Formatting Changes
Formatting changes, for example, changing autostyles, thresholds, subtotals.
If a user chooses the option Add to Section without Formatting, the grid/graph showing on the document will not use the report’s stored formatting. Any formatting changes on the source report will not be reflected on the document.
If a user chooses the option Add to Section with Formatting, the grid will be added with the current format of the report. However, any formatting changes made to the source report AFTER the dataset has been included in the document will NOT be reflected on the document.
For example, a user disabled the subtotal (see screenshot below) for the original report after the report has been included as a dataset in a document, the document will still show the subtotals.
To force the document to recognize the report’s formatting changes, the user needs to delete the grid/graph from document section and add it again using the With Formatting option. By doing this, the latest formatting properties of the grid/graph on the source report are retrieved.
Type 2 – Adding/Removing Objects and Modifying Report Filters
Another type of changes made on the report involving adding/removing objects and modifying report filters.
Unlike the formatting change, this type of change does carry over from the source report to the document datasets.
For example, if users add/remove/modify report filters (see screenshot below), the change will be reflected on the data when running the document.
If an object is removed from the source report (see screenshot below), the user can see the change in the document’s Dataset Objects window. After the user runs the document, the object will be removed from grid/graph on the document.
If an object is added to the report (see screenshot below), the change will show in the document’s dataset objects window. However, the object will not be automatically added to the grid/graph. The user has to manually add the object to the grid/graph or add the dataset to the section again to make it show up.
NOTE: As of MicroStrategy 9.0, a new feature was introduced where a user can add a dataset report to a Report Services document as a shortcut by selecting the Add to Section As a shortcut option, as shown below:
If the grid/graph is added to the document using this option, then the document would be updated automatically if ANY type of change is made on the source report.