Vous êtes sur la page 1sur 10

11/10/2010 Apply Comparison – Techniques | Micro…

Microstrategy Blog
Unofficial Tips, Tricks and Information about Microstrategy.

Home
About
Contact
Forum
Lifestream

Type text to search here...


Home > Flash, Tips and Tricks > Apply Comparison – Techniques

Apply Comparison – Techniques


June 22nd, 2009 Leave a comment Go to comments

Sometimes it’s easier to push the functions to the database level. As a MicroStrategy developer, and a SQL
programmer, I pick and choose my battles, and as much as it’s recommended in MicroStrategy to make
complex metrics with “Last” or different Level Dimensionality, there’s also situations where you want to make
the database do the work…such is the Case with the ApplyComparison filter.

Some key things to understand when making these formulas. The “SQL” portion of your code always come
first…and by first, I mean in quotes, right after your opening parenthesis. In this portion of code you have your
dynamic values, which is represented by the hash tag (#). The next part of your Apply references what that #0
references. For example:

microstrategyblog.com/…/apply-compa… 1/10
11/10/2010 Apply Comparison – Techniques | Micro…

In this case, I’m telling the database engine that I want this filter to include all [Fiscal Periods] up and including
’200905′. The value following the @ sign is the Form you’re using from your attribute creation. This technique
works wonderfully, though you have to be aware of the structure of your fact tables. Here’s a report of the SQL
that’s generated.

select
a12.ACCOUNT_GROUP_ID ACCOUNT_GROUP_ID,
max(a12.ACCOUNT_GROUP_DESC) ACCOUNT_GROUP_DESC,
(sum(a11.xAMOUNT) * -1.0) AMOUNT_YTD
from v_xFACT_TRANSACTION_Amt a11
join LU_ACCOUNT_GROUP a12
on (a11.ACCOUNT_GROUP_ID = a12.ACCOUNT_GROUP_ID)
where (a11.FISCAL_PERIOD_ID <= '200905')
group by a11.ACCOUNT_GROUP_ID

The reason a Function like ApplyComparison is so useful, is you can combine it with prompts, and make
complex SQL phrases, that otherwise would take some serious work using your basic MicroStrategy
microstrategyblog.com/…/apply-compa… 2/10
11/10/2010 Apply Comparison – Techniques | Micro…
functions…here’s an example.

ApplyComparison(“#0<#1", Customer@ID,?[CustomerPrompt])

So this filters for the first “X” amount of Customers based on a value you enter in a Prompt.

Granted, this can be done with multiple or simple filters in MicroStrategy, but, you’ll be surprised how much an
understanding of the Apply family of phrases can simplify some of your processes, ad well as how much easier it
makes categorizing and sorting your various filters. Is much easier to have your specific filters like above, all in
one folder, without having to track the multiple filters that may be included is dependents.

Categories: Flash, Tips and Tricks Tags: ApplyComparison


Comments (1) Trackbacks (0) Leave a comment Trackback

1.
sorin.suciu
June 23rd, 2009 at 02:00 | #1
Reply | Quote

Indeed, Apply functions are a great way to tweak the reports into complete submission.

1. No trackbacks yet.

Name (required)
E-Mail (will not be published) (required)
Website

Subscribe to comments feed


Submit Comment
MicroStrategy 9 – Office What I’m Up To
RSS

Translator

microstrategyblog.com/…/apply-compa… 3/10
11/10/2010 Apply Comparison – Techniques | Micro…

Dashboard Branding by: Jeremy


June 25, 2010, 18:26

Enter your email address:

Subscribe

Delivered by FeedBurner

Information Dashboard Now You See It


Design Stephen Few
Stephen Few Best Price $26.85
Best Price $13.89 or Buy New $29.70
or Buy New $23.09

Privacy Information Privacy Information

microstrategyblog.com/…/apply-compa… 4/10
11/10/2010 Apply Comparison – Techniques | Micro…

Visual Language for Picturing the Uncertain


Designers World
Connie Malamed Howard Wainer
Best Price $19.76 Best Price $14.49
or Buy New $26.40 or Buy New $19.77

Privacy Information Privacy Information

What I'm Doing...

For some reason today especially I miss Steve Gutenberg...he'd know how to set the world right. 2010-
07-02
Departmental BI to me now just means everyone is using whatever they want and one guy doesn't know
what the other is doing. 2010-01-07
New job. Day 1. Busy month... 2009-11-23
The report & metric filters are not passing to the SQL...so I'm querying our entire database.
@microstrategy Tech support being dialed now. 2009-09-03
1st MicroStrategy 9.0 speed bump. Anyone else seeing reports that used to take a minute now take 8
minutes? It's reports w/consolidations. 2009-09-03
More updates...

Powered by Twitter Tools

Recent Comments

Rob on MicroStrategy Sucks – Redux


Shefali on Dashboard – So What Happened
Josh on Dashboard – So What Happened
Josh on Report Data Options in version 9
Jeremy on MicroStrategy Dashboard Creation – Prologue

Blogroll
Aellament
Business Exchange
Intelligent Enterprise
MicroStrategy 101
MyMSTR
Potkin’s Oracle Notes
Random Thoughts on DWH and BI

microstrategyblog.com/…/apply-compa… 5/10
11/10/2010 Apply Comparison – Techniques | Micro…
Professional
Microstrategy

Theory and Practice


B-Eye-Network
BI Knowledgebase
Business Intelligence
Data Mining Research
Perceptual Edge
Smart Data Collective

Categories

Administrator (8)
Security (1)
Aellament (4)
All Things Data (13)
Architect (1)
Community (4)
Data Warehouse (12)
Documents (3)
Downloadable (9)
Error (2)
Featured (2)
MicroStrategy 9.0 (20)
Enhancement (3)
Microstrategy News (5)
General News (2)
MicroStrategy Office (7)
Excel (5)
Powerpoint (1)
MicroStrategy World (5)
2009 (4)
Not Microstrategy (8)
Notes From an Install (2)
Randomness (4)
Schema (1)
Theory (17)
Things I Learned (8)
Tips and Tricks (66)
Attributes (2)
Basic Series (19)
Consolidations (10)
Dashboards (12)
microstrategyblog.com/…/apply-compa… 6/10
11/10/2010 Apply Comparison – Techniques | Micro…
Drill Map (1)
Fact Creation (2)
Filters (4)
Flash (1)
Logical Table (1)
Metrics (2)
Preferences (1)
Reports (13)
SDK (2)
Transformations (3)
VLDB (2)
Web (7)
Widgets (1)
Twitter (8)
Uncategorized (5)
Video Presentations (1)
Wish List (5)

Tags

9.0 Add new tag Aellament Arcade Attributes Attribute Sort BI Columns Consolidation Consolidations Custom Dashboard
Dashboards Data Warehouse Documents Excel Facts Filters Formatting Grid Metadata Metadata Browser Metrics

Microstrategy MicroStrategy 9 MicroStrategy 9.0 MicroStrategy Office Microstrategy Sucks MicroStrategy

World 2009 Mooer's Law Negative Performance T uning Report Rows SDK Search by ID Settings SQL Street Fighter 2
Transformations Twitter VBA VLDB Web Widget
Recent Comments
Rob on MicroStrategy Sucks – Redux
Shefali on Dashboard – So What Happened
Josh on Dashboard – So What Happened
Josh on Report Data Options in version 9
Jeremy on MicroStrategy Dashboard Creation – Prologue

Search for: Search

Meta
Register
Log in
Entries RSS
Comments RSS
WordPress.org

microstrategyblog.com/…/apply-compa… 7/10
11/10/2010 Apply Comparison – Techniques | Micro…

Categories
Administrator
Aellament
All Things Data
Architect
Community
Data Warehouse
Documents
Downloadable
Error
Featured
MicroStrategy 9.0
Microstrategy News
MicroStrategy Office
MicroStrategy World
Not Microstrategy
Notes From an Install
Randomness
Schema
Theory
Things I Learned
Tips and Tricks
Twitter
Uncategorized
Video Presentations
Wish List

Blogroll

Aellament
B-Eye-Network
BI Knowledgebase
microstrategyblog.com/…/apply-compa… 8/10
11/10/2010 Apply Comparison – Techniques | Micro…
Business Exchange
Business Intelligence
Data Mining Research
Intelligent Enterprise
Microstrategy
MicroStrategy 101
MyMSTR
Perceptual Edge
Potkin’s Oracle Notes
Random Thoughts on DWH and BI
Smart Data Collective

Microstrategy Employment
Data Warehouse Manager
Senior Software Design Engineer (Mobile Devices)
Consultant - .Net/SDK Integrator
Marketing Systems Analyst - Unica experience
Architect IT MSTR (65514)
Senior DataWarehousing Developer
Microstrategy Developer
SQL Developer (PostgreSQL)

Subscribe in a reader

www.IBM.com Ads by Google

Meta

Register
Log in
Entries RSS
Comments RSS
WordPress.org
microstrategyblog.com/…/apply-compa… 9/10
11/10/2010 Apply Comparison – Techniques | Micro…

Top WordPress
Copyright © 2008-2010 Microstrategy Blog
Theme by NeoEase. Valid XHTML 1.1 and CSS 3.

microstrategyblog.com/…/apply-compa… 10/10

Vous aimerez peut-être aussi