Review new PowerPivot workbooks on SharePoint using approval workflows

June 1, 2010

Posted by Kasper de Jonge

Now something not really about the PowerPivot engine but something i think will be very nice to set up on yourSharePoint environment.

At the excellent linkedin discussion on PowerPivot, someone suggested that we might make review of a PowerPivot file possible. I answered we can because the PowerPivot gallery is a document library and we can manage approval workflows on this gallery. But i also wanted to check it out how I can do this.

In this blog post i’ll show you how to configure a PowerPivot gallery so that all new PowerPivot workbooks published to a PowerPivot gallery are reviewed by IT. I used a blog post i found which explains howto configure approval workflows step by step.

We start at our PowerPivot Gallery:

To enable workflows we go to Workflow settings in the library tools:

Select the current library and click add new workflow, we now get to our workflow settings:

We want to use the Approcal – SharePoint 2010 workflow, set a appropriate name  ”PowerPivot approval”, we want a new task to be created at the reviewers task pane for every document that is added to the library. Next, we define the history list for the workflow. History lists are special logs which monitor the execution of the workflow. At each step of the workflow, messages at written to the log upon execution of the step. I want the workflow only to be executed when i upload a new file to the gallery:

We now can set up who the approvers are responsible of reviewing the PowerPivot workbooks, the settings are pretty straightforward.

Assign approvers, enter a request they will see at the workflow. The other settings aren’t necessary to complete the workflow.

We now can save our workflow and it will be in effect immediately.

When i now upload a new document to my PowerPivot gallery, we can see that the PowerPivot approval is in progress:

When i would look at my tasks lists within the same site collection i would see my new PowerPivot sheet is awaiting my review:

And we can open this workflow and comment on it, we can also open the document to look inside it:

We just approve my workbook now. When we check back at the gallery to see our workbook is approved:

So using workflow we can make an additional step in our Managed self service BI, and it is very easy to set up.


Building a cash flow statement in PowerPivot using dynamic measures in DAX

June 1, 2010

Posted by Kasper de Jonge

UPDATE FROM ROB:  You can now find all kinds of Accounting and Financial Techniques filed under a category created specifically for them.  To view those posts click here:

http://www.powerpivotpro.com/category/accountingfinancial-techniques/

Also, there is now also ANOTHER in-depth example of cash flow statements here:

http://www.powerpivotpro.com/2011/12/cash-flow-statement-in-powerpivot/ 

(Now, back to Kasper’s excellent post)

I got an excellent question at my “Ask a question page” on my blog. Greg asked me if i knew of a sample for a cash flow statement in PowerPivot. I did not know of one, and to be honest i didn’t even know what a cash flow statement was :) .

Searching for a sample i found this picture of a cash flow statement:

This made things more clear. We want to see income and expense in two different tables. And then in a new table the cash flow statement where we can see the starting cash at the start of a month, income and expense in the month and the ending cash with the values at the end of the month.

I got really excited to solve this using PowerPivot, so I decided to build a sample myself. First i had to create a fact table that contains the values of the income and expense, i used the picture from above to create sample data:

As you can see we have income and expense for days in three months. To determine if a specific activity is income or expense, i created a secondary table that groups my activities:

We can create a relationship between the two tables so we can put them in a table and calculate a measure with income – expense.

Next i created a separate related time table to use in time intel. functions:

We create relationships between the date from the facttable and the new date table

Now we can create the first table putting income and expense in one table per month using only the relationships between the tables and no DAX:

Now for the interesting part, how do we create the cash flow table.

What we really need is a way to create 4 different calculations per row for each month on column, as we can see in our sample we need to have the following measures:

  1. Starting cash= the total ytd of (sum of disbursements – sum of receipts) until the previous month
  2. Receipts = sum of Receipts at the current month
  3. Disbursements = sum of Disbursements at the current month
  4. Ending cash = the total ytd of (sum of disbursements – sum of receipts) until the current month

These measure will translate to dax as the following:

  1. TOTALYTD(Activities[Sum of Value](‘Group’[group] = “Receipts”) – Activities[Sum of Value](‘Group’[group] = “Disbursements”),DATEADD(‘Date’[Date],-1,MONTH))
    subtract values from group disbursements from values of the group receipts for the totalytd until the previous month
  2. Activities[Sum of Value](‘Group’[group] = “Receipts”)
    values from group  receipts in the current month (current column context)
  3. Activities[Sum of Value](‘Group’[group] = “Disbursements”)
    values from group disbursements in the current month (current column context)
  4. TOTALYTD(Activities[Sum of Value](‘Group’[group] = “Receipts”) – Activities[Sum of Value](‘Group’[group] = “Disbursements”),’Date’[Date])
    subtract values from group disbursements from group  receipts for the totalytd until the end of the current month

But how can we do this in PowerPivot ? We need to determine what to calculate per row .. to do this we can use dynamic measures in DAX, as in this excellent post from MSFT Howie Dickerman.

First we need to be able to put values on the rows on which we can base our measures, to do this i created a new table in excel with rows and loaded it into PowerPivot:

We now can put these row labels against months in a new pivottable:

Now we can create a measure which uses the current row context to determine what to calculate at the measure. When we use the VALUES function we can see what the current row context for our Cashflow[CashFlow]  is and use this in an IF  statement in the measure to calculate a different measure for each row.

The formula will look like:

= IF(COUNTROWS(VALUES( Cashflow[CashFlow])) =1,
IF( VALUES(Cashflow[CashFlow]) = "1 Starting Cash",  TOTALYTD(Activities[Sum of Value]('Group'[group] = "Receipts") - Activities[Sum of Value]('Group'[group] = "Disbursements"),DATEADD('Date'[Date],-1,MONTH)) ,
IF( VALUES(Cashflow[CashFlow]) = "2 Receipts",  Activities[Sum of Value]('Group'[group] = "Receipts"),
IF( VALUES(Cashflow[CashFlow]) = "3 Disbursements",  Activities[Sum of Value]('Group'[group] = "Disbursements"),
IF( VALUES(Cashflow[CashFlow]) = "4 Ending Cash", TOTALYTD(Activities[Sum of Value]('Group'[group] = "Receipts") - Activities[Sum of Value]('Group'[group] = "Disbursements"),'Date'[Date]) ,
BLANK())))), Activities[Sum of Value])

This will create one measure that depending on the row context shows different calculations.
Resulting the actual cashflow pivottable:
You can see that the values are calculated per cashflow type per month showing a different calculation. I hope this was what Greg meant :)
This example shows again the great power of DAX, a lot of things are possible. I still get really excited about PowerPivot.
The sample file can be downloaded from my skydrive.

The PowerPivot job posting I mentioned earlier

June 1, 2010

Posted by Rob

Here it is:

image

That was posted nearly two months before PowerPivot was released :)

It was available last week but as of today the listing appears to have been taken down, filled.

Which one of you fine folks grabbed it? :)


Kasper de Jonge joins PowerPivotPro!

June 1, 2010

 
Custom Wooden Hoops Clogs

“Hey!  Where’d you get that pic??”

-Kasper “The Killer Ghost” de Jonge

Guest Poster Becomes Co-Owner!

Over the past few months, Kasper has provided a number of excellent guest posts – the most prolific guest poster in this blog’s short history in fact.

I have to wait until next week to find out exactly how good Kasper is at hoops.  But I already know he plays a mean game of PowerPivot.  In fact he plays a mean game of… numbers in general.

Quite simply, he receives the PowerPivotPro “Zero Doubt” stamp of approval.

OK…  what does this mean?

Pretty simple really.  You get more good advice, examples, and tips.  Kasper has a ton of great stuff to share, like the post above, and I thought it was time everyone saw more of it.  We’re taking off the “guest post” flag for Kasper and giving him a set of keys to the car.

In all honesty, I learn at least as much from Kasper as he does from me.  We have different backgrounds – he has more experience in traditional BI than I do, and I have more Excel experience.  He and I chat all the time, swapping observations and techniques – via email, IM, Skype, and Twitter.

Rob, are you still going to post?

Yes, I  have no plans to stop blogging.  In fact you’ll be seeing even more of me going forward once I’m done launching our company’s PowerPivot-based product line.

My evil long-term plans exposed!

Fact is, I want the name “PowerPivotPro” to not just be an alias for “Rob Collie.”  I want it to mean something more than that.  A community.  A designation – where people say “I am a PowerPivotPro.”  It’s a new style of professional that’s just getting off the ground, and in the future we will see PowerPivot skills and certification specifically targeted by recruiters, internally trained for within corporations, and listed on resumes in the same way someone would list C++ or T-SQL as their primary skill today.

Go back and read this post for a clearer idea of what I’m talking about.  I absolutely believe we are headed for a world like that.

Kasper and I just happen to be early to the party.  I suspect there aren’t many people in the world so far who have been paid specifically to provide PowerPivot expertise (which we both have).

But it’s ramping up faster than you might think.  I just saw a job posting where the recruiter mentions PowerPivot specifically as a “must-have” or “must-learn."  Cool huh?  It hasn’t even been released for a month :)

So, welcome Kasper.  The Bio Page has been updated to reflect his presence on the staff and certification as a trusted PowerPivotPro.

More may join us over time.  Rest assured that the bar will remain high :)

And Kasper, I’m still gonna do my absolute best to crush you next week :)