Archive

Archive for the ‘Things I Learned’ Category

Push It To The Warehouse

January 6th, 2010

At this point I think that I’ve worked with enough instances and installations of MicroStrategy to know bad and good ideas when I see them. The most common irritation that I’ve come across is this idea that MicroStrategy is where all of the heavy lifting of the parsing and hierarchies takes place. While MicroStrategy can do the heavy lifting, this isn’t always ideal.

For instance:

I worked with a client whose Accounting General Ledger was your basic structure. Let’s say the account structure was thus:

Revenue accounts were 5000 – 5999
Cost of Goods Sold were 6000 – 6999
Expenses were 7000 – 9999

Now, in a MicroStrategy environment, one could create custom groups so that these GL accounts could be properly categorized that defines ranges, but that’s seldom the best way to go about it.

I have predefined categories that I know that I want postage as an expense to roll into. Postage -> Shipping ->Expense.

I create a table called GL_GROUP, which is the next level up of the hierarchy, and added a column to the GL_ACCOUNT able which was a reference to this new table. Here’s the GL_ACCOUNT table.

GL_ACCOUNT_ID GL_ACCOUNT_DESC GL_GROUP_ID
5001 Cat A Sales
5002 Cat B Sales
8001 Corp Salaries
8002 Admin Salaries
8003 Sales Commission

Note that the GL_GROUP_ID Column is currently Null.

The GL_GROUP table looks like this.

GL_GROUP_ID GL_GROUP_DESC GL_LOW GL_HIGH
500 General Revenue 5000 5499
550 Misc Revenue 5500 5999
600 Manufacturing 6000 6999
700 Administration 7000 7999
800 Salaries 8000 8499

The script that accompanies this table is as such:

UPDATE lugl
SET lugl.GL_GROUP_ID=lug.GL_GROUP_ID
FROM GL_ACCOUNT lugl
JOIN
GL_GROUP lug
ON
lugl.GL_ACCOUNT_ID between lugg.GL_LOW AND lug.GL_HIGH

This has been incorporated into the ETL process so that as any accounts are added and they fall into the appropriate range (the Accounting people have to be on top of good logic on their side). Once complete, you get this.

GL_ACCOUNT_ID GL_ACCOUNT_DESC GL_GROUP_ID
5001 Cat A Sales 500
5002 Cat B Sales 500
8001 Corp Salaries 800
8002 Admin Salaries 800
8003 Sales Commission 800

Now, pull the GL_GROUP table into the Warehouse Catalog, add a GL_GROUP attribute, and modify your GL_ACCOUNT attribute so that it’s the child of GL_GROUP as a one-to-many. Now some of you will look at this and just go “Duh”, but you’d be surprised not only how many MicroStrategy installations I’ve come across where people have made Custom Groups to deal with this (because of the “ranges” of accounts). Custom Groups slow things down.

In short, let the Warehouse do the heavy lifting during your ETL process…and let MicroStrategy be a clean and streamlined as possible when it pushes the SQL through. MicroStrategy can solve this problem alone. But should it? I think not.

All Things Data, Data Warehouse, Things I Learned

FreeForm SQL Reports

December 3rd, 2009

A while ago I had the opportunity to prepare a short training on the FreeForm SQL reports for some of my colleagues. I thought I’d better share this with you as well, so… here is a not-at-all-exhaustive list of things worth knowing about this type of report.

What is a FF SQL?

FreeForm SQL (aka FreeStyle SQL) is a type of report which allows the designer to define its own SQL code. Notice this is a rather different approach than what we are normally used to in MicroStrategy, where we would usually let the SQL Engine do the job.

When should it be used?

1. Whenever you tried everything (VLDB properties, Metric Levels, Attribute Relationships, Table Logical Size, Data Model changes…) and the SQL Engine still doesn’t perform that join the way you want it to.

2. Whenever you want to use a data source which does not exist in the Warehouse Catalog. That’s right, with FF SQL you can use almost any data source, including those tables you see in the left hand side of the Catalog.

How do I recognize it?

You don’t, at least not from the outside. You can either edit a report and see if you can spot the unnoticeable “Freeform SQL Definition” button, or you can right click on a report and make a component search. If it has no components, you found it.

So, unless you set up some naming convention for FF SQL reports you will very soon lose track of them.

How is it created?

Click on “New -> Report” and select “Freeform SQL” from the list (you need a special role to see this option).

Type your code in the upper right hand side frame.

Now you have to map the items from the “Select” section of your script to virtual Attributes and Metrics. To do this, right click on the lower frame and select either “Add new Attribute form” or “Add new Metric”.

For a script like “SELECT country_id, country_name, SUM(sales)…” the mapping should be defined as:

FF SQL

These are virtual objects. You may actually have a “Country” Attribute in your project, but please don’t make the mistake of thinking these two are the same thing.

Click OK and you are back on familiar grounds.

Prompts in FF SQL

You can either create or insert them into a WHERE clause, by using the two dedicated buttons. The Prompts will show in bold pink.

Now, here is the interesting part. Let’s say you want to make some changes to the script, and you copy it into an external editor. You will notice that the prompts were converted into object IDs. Now, paste the text back into the FF SQL editor. They are bold pink again. Too bad the report won’t work anymore…

The prompts will have to be inserted again, the “button” way, if you want the report to run properly.

Words of caution.

Being what I call a “manually defined object”, the FF SQL is not subjected to automatic Schema updates. That is to say, you won’t be warned if you delete a table which is being used by such a report. So please bear in mind that maintenance for FF SQL can be harsh.

Reports, Things I Learned ,

IS SDK Kit (part 3)

November 2nd, 2009

Note: Part 3 includes the work done so far in Part 1 and Part 2.

You probably found out by now that the Type and SubType properties of an IDSSObjectInfo (or similar class) return a numeric value. Call me picky, but if I were to build an application I would rather use layman’s terms such as Attribute or Drill Map instead of SubType 3072 or SubType 14336.

This third part of our tutorial offers a great way to convert these not-so-intuitive numerical values into their English meaning, by using a custom made function called DSS2Name.

You can download the VB6 files here:
SDK Kit part 3.zip

Downloadable, Things I Learned, Tips and Tricks , , ,

Intelligence Server SDK startup kit

August 2nd, 2009

I happen to know a guy or two whose curiosity for Intelligence Server SDK increased alarmingly in the last couple of months.  I dedicate this article to them, and anybody who would like to get their hands dirty with some cool stuff.

But first of all, what is IS SDK? Most of the SDK guys are familiar with the Web SDK, the one which allows endless customizing to the web interface of MicroStrategy, amongst other things. Intelligence Server SDK, on the other hand, deals with reading, creating, modifying and executing objects from your Metadata. One can easily consider it to be Command Manager’s big brother who went to College. Unlike Command Manager, IS SDK is anything but user friendly. But man, it packs a serious punch if you learn how to handle it! The documentation and Tech Notes do provide all the necessary information to do just about anything, but actual examples are scarce.

IS SDK can be used via Visual Basic or C++. Since I’m by no means a pure breed programmer, I work with VBA, which is more or less like speaking English to the computer.

Enough introductions already. If you want to unleash its power, the first thing you must do is connect to a project. This apparently simple task poses enough challenges to deter many an enthusiastic programmer from going any further.  I find this counterproductive and quite discomforting.

This is why I assembled a startup kit customized for VB6, which offers the code and explanations on how to connect to a project. Actually, it is the exact form that I used for Metadata Browser.

Download here:
Connection1.zip

Updates and new tips may come in the future, depending on your feedback.

Downloadable, Things I Learned , , , ,

Consolidations Don’t Pivot

July 10th, 2009

…also known as Things I Learned The Hard Way – Part.2

A Consolidation is a great way to visually group data…but there are MANY problems that consolidations can create.

Specifically, an over-zealous pivoter who doesn’t understand the finer points of MicroStrategy can make a real mess of things. Consolidations are great for making income statement, balance sheets, or any drillable report that has specific subtotal or formatting requirements. Below is a standard consolation.

We have out various elements, and some subtotals that we want to see. On the image below, if I add the account category that drives those subtotals, I add them to the Grid. So now you see how the Consolidation actually treats each element.

Now, if we pull off the consolidation, look at what happens to the “Account Category” (ignoring the sort order). The new dynamic totals created are no longer accurate, they’re the sum of each item, plus every subtotal that the attribute appears in.

Here’s what the report should look like. Look at the Object Manager on the left to see that the consolidation has now been removed from the report objects….and…Tada! The correct results.

So, make sure that your Web Pro users know that they have to be very aware of the elements that are in their reports before they start ‘OLAP’ing themselves into inaccurate data.

Consolidations, Things I Learned ,