Rank and STDEV in Power Pivot 2012

I was prompted to write this post based on a question in the SQL forums.

There is a single table of data containing thousands of transactions by Customer, Year, Origin, Type.  The measure is Sales.

The output needs to show the Rank of each Customer  based on Sales for the subset of data defined by the Year, Origin & Type.

Without Power Pivot this would be quite painful to create but with Power Pivot 2012 we have the new RANKX function. Continue reading

Posted in Power Pivot | Tagged , | Leave a comment

New Features in PowerPivot v2

PowerPivot v2 for SQL 2012 was released in March.  Some of the limitations we had in v1 of the product have been solved in this v2 release which makes modelling easier and enables the analysis of large items in a better way.

In this post we’ll look at two of the main improvements.

1. Role Playing tables

2. Hierarchies Continue reading

Posted in Power Pivot | Tagged , | Leave a comment

BI Leadership

Having worked on and experienced a number of BI projects I thought I would write about my experience focussing on the area of leadership.

Being a management accountant I am naturally biased to think Finance should lead a BI project.

Many BI projects are led by Finance.   This is due to many reasons.  I believe the primary reason is that Finance often have the most at stake in the projects successful outcome.

That’s sorted then.   Well, not really. Continue reading

Posted in Performance Management | Tagged , | Leave a comment

Row Context and EARLIER()

With PowerPivot there is a concept called Row Context.  The Row Context consists of a single row of a table.   Certain DAX functions have an iteration function.  One of these is SUMX().  The SUMX function iterates over the rows of the table and aggregates the values found in the column you specify.

When you create nested expressions in DAX you will come across nested Row Contexts. You can think of the first row context as a loop with the second row context being an inner loop.  As per the diagram below.

Loop with nested loopThis is all fine, however, by default the row contexts are not aware of each other, hence, if you want to refer to the value in the outer loop within an expression from the inner loop then you need to use the function EARLIER().

The EARLIER function takes two parameters, the first is the column we want to refer to and the second is the number of tabe scans to go back, the default is set to 1.  There is also a Refer to outer loopfunction called EARLIEST which as you might have guessed refers to the outer most table scan.  These functions are mainly used in calculated columns  created from the Power Pivot window.  To illustrate the function I’ve created a data set consisting of weekly sales.

data table

We’ll create a new column to calculate the cummalative sales

=sumx(
filter(Table1,Table1[Week]<=earlier(Table1[Week],1)),
Table1[Sales]
)

The SUMX function creates the first table scan.  The FILTER function creates the second table scan.   Let me describe what is happening here.  In the first table scan we get to row 1 and the filter function is executed which filters the rows based on the week number being less than or equal to the current row.  The Sale column for the filtered rows is then aggregated.

As the SUMX function gets to the second row the process is repeated.  This time the FILTER function is returning weeks < =  2 hence the prior week is included in the row set.

This is repeated during the rest of the table scan resulting in a aggregation that covers an increasing range.

Calculated Results

I’m using this cummalative calculation to demonstrate the EARLIER function.   There are better ways to create cummalative calculations with the time intelligence features of DAX so use this example as a learning aid.

I hope you’ve found this post useful.  This is an advanced topic so don’t be concerned if you didn’t understand at the first read.   Re-create the example using your own data set and you should hopefully get the gist of what is happening.

Over and out.

Lee

Posted in Power Pivot | Tagged , | Leave a comment

Context is King

If you’re new to Power Pivot (especially if you have an Excel background) it’s very beneficial to study Power Pivot context before trying to learn DAX.  The context provided by Power Pivot enables the creation of dynamic calculations that respond to user selections.

It’s not hard, it’s just different to what your probably used to.

There are 2 types of contexts in Power Pivot. Continue reading

Posted in Power Pivot | Tagged , | Leave a comment

Spatial analysis with Bing Maps & Excel

After months of BI work in the office I finally got the opportunity to take a break and get out of the office to see the field sales end of the business.

Additionally, in the last couple of months I’ve been learning about the world of spatial analysis after reading the great blog from Alastair Aitchison and stumbling across the mapping features of SSRS.

So for the 1st topic of 2012 I give you an off-topic subject : Spatial Analysis with Bing Maps & Excel. Continue reading

Posted in Spatial Analysis | Tagged , , | Leave a comment

Shaping data to handle many to many

With Power Pivot we’re able to bring in data from disparate sources and mash them together to provide greater insight.

It’s likely you’ll come across data that hasn’t been normalised. This means you’re likely to come across a situation where the relationship between 2 tables is of a type Many-Many. This means there are many rows in each table that are related to each other.

I’ve created a scenario where we’re joining a Sales table with a table from a CRM system that holds information on Activity cost.
Continue reading

Posted in Power Pivot | Tagged , | Leave a comment

MDX functions – Except & Filter – intermediate level

I’ve been getting to grips with MDX functions to aid analysis and reporting.  The recent functions I’ve come across are EXCEPT & FILTER.

In this post we’ll look at an example where these functions can come in handy.

If this is the first thing you’ve seen of MDX then this post is not for you.  I’m in the process of writing some introductory material for MDX that I will share on this site when it’s finished.

Before we get started it’s worth looking at what EXCEPT and FILTER do.
Continue reading

Posted in Analysis Services | Tagged , , | Leave a comment

Data modelling for Excel users

In this post we’ll have a basic look at the transformation of data usually seen in Excel into a format that is better suited for Business Intelligence.

In the screen below we have an extract of data from a Financial system.

To model this data for Business Intelligence it’s better if we split the table into multiple tables.

Continue reading

Posted in Power Pivot | Tagged , | Leave a comment

Some insights on the ‘single version of the truth’ issue

Let me tell you about a meeting I had to challenge directors on business performance. I imagine you’ll be familiar with the story.

I began to talk about the fall in revenue for a particular business unit. The sales director immediately turned defensive and started to dispute the numbers I was reporting. This led to the agenda of the meeting changing and I lost my opportunity to challenge the director.

I had confidence in my team, this led me to believe the sales director was playing with ’smoke and mirrors’ to dodge the discussion. It was even worse, there were other directors in the room. I began to wonder if our credibility was at risk.

Continue reading

Posted in Performance Management | Tagged | Leave a comment