Archive

Archive for June, 2011

Combining SSAS’s DefaultMember and Roles

June 16, 2011 Leave a comment

I’ve been asked if a cube could be exposed to users so everyone gets ‘their’ view of data by default, but is able to compare with others if they wish. a combination of setting the DefaultMember on a per-role basis seems to be the answer. Take an AdventureWorks example: if I’m a sales manager responsible for the UK, most of the time I only want to report on that. But, come annual review time I probably want to see how I compared to my peers. If there’s a ‘UK Manager’ role set up in the cube, to which I belong, when I build a pivot table I see just values for the UK by default:

image

But, if I choose to include Countries in the query, everything shows up:

image

To set up the role, choose the appropriate MDX statement in BIDS:

image

Make sure you’ve got the corresponding Attribute chosen in the drop-down and specified in the MDX (Country in this example).

Advertisements
Categories: SQL / BI

Bubble-up Exceptions in SSAS KPIs

June 16, 2011 Leave a comment

A requirement to see, at a summarized level, how many exceptions appear at lower points in a hierarchy is a pretty common OLAP scenario, known as ‘bubble-up exceptions’. ProClarity’s KPI Selector did a great job of defining these, but when it’s not available, you can define them as a SSAS KPI. An example from AdventureWorks showing how many products there are with below 37% GPM (paste into the Value Expression in BIDS):

IIF
(
    Count
    (
      Filter
      (
        Descendants
        (
          [Product].[Product Categories].CurrentMember,
          [Product].[Product Categories].[Product]
        ),
        
            (
              [Measures].[Internet Gross Profit Margin],
              [Product].[Product Categories].CurrentMember
            )
          > 0
        AND 
            (
              [Measures].[Internet Gross Profit Margin],
              [Product].[Product Categories].CurrentMember
            )
          < 0.37
      )
    )
  > 0,
  Count
  (
    Filter
    (
      Descendants
      (
        [Product].[Product Categories].CurrentMember,
        [Product].[Product Categories].[Product]
      ),
      
          (
            [Measures].[Internet Gross Profit Margin],
            [Product].[Product Categories].CurrentMember
          )
        > 0
      AND 
          (
            [Measures].[Internet Gross Profit Margin],
            [Product].[Product Categories].CurrentMember
          )
        < 0.37
    )
  ),
  NULL
)

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

Here’s your result:

image

Categories: Uncategorized