Leaving Microsoft

February 26, 2010

 
silly walk

“And now for something completely different.”

As far as I can tell, most people think this site has been part of a new, concerted “Marketing 2.0” initiative by Microsoft.  I’ve been flattered by that impression, to be honest :)   But now the time has come to dispel the illusion.

I mean, clearly MS is beginning to recognize the value of social media.  There are indeed official Twitter and Facebook entities for PowerPivot, for instance.  And the fact that people like myself, Dave, and Denny have been allowed to do so much blogging reflects a new awareness.

Heck, I in particular have been allowed to spend the majority of my time each day on this site and other evangelism/education efforts, while being a member of the engineering team.  That truly is a departure from the norm.  But the motivations (and permissions) behind my situation are completely “non corporate” in origin.

The real origins

Some of you may recall that I moved from Redmond to Cleveland last summer for family reasons, after thirteen years of building software in Redmond.  My management team back in Redmond wasn’t sure what to do with me at that point, or what the timing would be, but it was mutually understood that I wouldn’t be able to keep my product team role forever.

Outside of Redmond, I basically knew…  no one.  So…  what better way to get to know people than to start a blog?

And PowerPivotPro.com was born.  I paid for everything myself – domain name, WordPress.com fees, even had a custom logo made.  My girlfriend helped me with the site theme.

Off I went.  And no one stopped me :)  

Thank you, SQL BI Managers

They had every right to stop me, to make me do something else, but they didn’t.  And while I was never privy to the backroom discussions about my activities, I am positive that their reasons for letting me run with it were NOT rooted in a desire for PR. 

Hard to believe perhaps, but knowing the people involved, it was simply a nice, merciful, and generous choice that they made.  Keep that in mind next time someone casts Microsoft as the Evil Empire.  I’ve met some amazing, uplifting human beings over the years.  And I was lucky to be reporting to some of them when the fit hit the shan.

“A funny thing happened on the way to the theater…”

Another cool thing happened next.  I discovered that I loved this community role.  Meeting people.  Helping people.  Educating people.  Brainstorming with intelligent and creative data people, from literally right down the street to places like Stockholm, Detroit, Brazil, the UK, and the Netherlands.  Oh, and drowning them in movie quotes :)

I’ve kinda found my calling, in a way.  I see myself doing things like this for a long time.

But now that the PowerPivot v1 release is in the home stretch, the product team is switching gears over to planning the next release.  That’s the phase when they need Program Managers (that’s me) the most, and I can’t do the necessary types of planning work from Cleveland.

So it’s time for me to give them their spot back, so that they can fill it with another PM and do an excellent job on the next release…  for all of us.  My last official day at MS is Tuesday.

So what next?  Three things.

1) Keep doing all of this :) Couldnt find three ended candle, give me a break ok

As I said above, this community interaction has charged my batteries in a big way.  So I’m going to keep at it :)   This blog, the FAQ, Twitter – I’m still going to be doing all of these things.

And as I’ve said before, BI is the place to be, especially in economic times like these.  I’m very much betting on the MS BI platform with all of my future efforts. 

2) Training and Consulting

As a natural extension of my community efforts, I think it makes sense to make myself available as a trainer and consultant.  Not many people have the particular mix and depth of experience that I do, and based on my interactions with MS customers over the past couple of years, I think I have a lot to offer.

I am open to partnership opportunities in this space – I think it makes sense at times to work closely with SharePoint and Database pros.  Drop me a note if you are interested.  I’m still very early in this process, and have some time to figure it out.

3) Back to Inventing!

Other than my friends, the thing that I miss most about Redmond is the ability to create.  It’s an amazing feeling to start with a completely blank slate, just a spark of an idea, and two years later be looking at a product like PowerPivot.  I thrive on that, so I’m also looking at options where I can burn the candle at all three ends, and build new products and services.

Stay tuned as I figure that out :)

Thanks for reading this far

I struggle to control my long-winded nature, and have been doing ok at that lately, but when it comes to personal stuff I quickly revert to old habits.

Thanks everyone – for reading this post as well as tuning in over time.

Sister blog on 14 years at Microsoft?

I have a number of more personal observations and stories – many of which are about nearly 14 years spent at Microsoft – that I am often tempted to share.  I’ve seen and experienced things that I cannot imagine happen too many places.  I refrain from sharing though, mostly to keep the content here as on-topic as possible.

I’m debating publishing those elsewhere over time, on a sister blog.  If I did so, it would be primarily for me, like a diary or time capsule, but the flavor of it might change if others were interested.  Drop me a note or comment if so.


Just call me Pivot… MC Pivot

February 25, 2010

 
 MC Hammer Today

“Yo, let me bust the funky analytics.”

ShareSquared, one of Microsoft’s Gold Certified partners specializing in SharePoint deployments, is conducting a webinar on PowerPivot next week.  SharePoint MVP Paul Stork, as well as Chris Givens, tech trainer extraordinaire with an alphabet soup of certifications, will be conducting the session.

That’s pretty cool as it is, but they’ve also asked yours truly to moderate the session!  Quite an honor :)   Can I call myself the MC rather than the moderator?  Why yes, yes I can.

So if you’d like to “attend” next week, click here to register.  I’m told signups already exceed 1k – let’s see if we can break Live Meeting :)


ALL() Revisited

February 23, 2010

 
No Filter

 

“He has no filter. He says whatever comes through his mind. He never edits himself.”

 

 


Revisiting ALL()

Yes, I’ve used ALL() a number of times already.  But I’ve never covered it directly – it’s always been a side topic to something else.  So I thought it was time I went back and made sure I had a specific post on it.

The short version is: ALL() removes filters from specific fields during a measure calculation.  It “De Niros” your measure… but in a controlled manner.

Syntax

    ALL( table_or_column, [column1], [column2], etc.)

So the first parameter is required, and can either be a single column or an entire table.

After that, you can specify as many other columns as you’d like…  as long as the first parameter didn’t specify a table. If your first  param is a table, you can’t specify additional columns.

Also note that even when specifying columns, the ALL() function requires you to always include the table name.

Lastly, all columns listed must be from the same table.

Legal Examples:

  1. ALL(Table1)
  2. ALL(Table1[Column1], Table1[Column2])

Illegal Examples:

  1. ALL([Column1])
  2. ALL(Table1, Table1[Column3])
  3. ALL(Sales[Column1], Customer[Column2])

When to use ALL() – Example #1

You never use ALL() by itself.  You always use it in the context of another function.  It’s all about setting context for a calculation.  It is not a calculation unto itself.

The simplest place to use ALL is in a measure that always shows you a grand total of something, regardless of what filters are in play.  Revisiting the Temperature Mashup demo for a moment, here’s a pivot sliced by Temperature, showing a normal Sum of Order Quantity:

Sum of Qty Only 
Now I add a measure that sets the Temperature table to ALL:

    [AllTempsQty] = CALCULATE(
                      SUM(Sales[OrderQuantity]), 
   
                    ALL(Temperature)
                    )
 

That ends up looking like:

PowerPivot Measure using ALL

(If you need a refresher on CALCULATE, which is probably the most useful function in all of DAX, check out this post.)

So, on Hot days, we sold a total of 2,245 Accessories.  And overall, across all temperatures, we sold 36,092 Accessories.

But note that the numbers are different across Category for both measures.  That’s because [AllTempsQty] did not use ALL against the Category columns (or table).

Cool.

Example #2 – % of Total

OK, but in many cases, you don’t actually want to see [AllTempsQty] in the pivot.  You just want to compare the filtered version of a measure to the unfiltered version.

So we can define something like:

  [PctOfAllTempsQty] = SUM(Sales[OrderQuantity])  / 
                       CALCULATE(
                          SUM(Sales[OrderQuantity]),
                          ALL(Temperature)
                       )

Which gives us:

Percentage of Total PowerPivot Measure using ALL function

Note that I switched Excel’s number formatting for this measure to be Percentage, keeping me from having to include * 100 in my measure.

Of course, if I wanted to keep my [AllTempsQty] measure, then I could have defined my new percent total measure as the following instead:

  [PctOfAllTempsQty] = SUM(Sales[OrderQuantity]) / 
                       [AllTempsQty]

                    

And that would have produced the same results.

Example #3 – Using ALL() in places other than CALCULATE()

If we revisit the post on derived measures, ALL() is an excellent modifier to use against an existing measure.

Let’s take a measure I defined in the Temperature Mashup, the [Qty per Day] measure:

Quantity per Day

And then we define a new measure:

  [QtyPerDayAllTemps] = [QtyPerDay](ALL(Temperature))
                 

That yields:

Using ALL function to derive another measure

You like?  I like :)


Generating a Tag Cloud via PowerPivot

February 21, 2010

blog1 “Navajos say it is good plan to have two arrows for one bow”

– Chief Thundercloud

Thanks to Rob Collie for letting me do another guest post. There will be a bit more Excel than PowerPivot in this post, but that’s what you get when you give MrExcel access to the blog!

Donald Farmer issued an interesting 3rd challenge for the Alpha Geek Challenge contest. He was looking for interesting visualizations created from PowerPivot pivot tables – something beyond the regular charts. 

Please take a look at the contest and vote for your favorites.

Update: Here is a link to an animated GIF showing the tag cloud in action. Watch the slicers along the right as well as the tag cloud and the SmartArt. Also, when you click on the next image, you should see a higher-resolution screen capture.

blog16 My entry uses 40,000 rows of Billboard Hot 100 Music Chart data and throws just about every visualization that I could think of:

  • A Decade slicer. This slicer was dragged outside of the bounding box so that I could make the buttons larger than usual and use two columns.
  • Four paired line charts that compare the decline of the Vocals genre and the rise of Country and Rap. These charts are static and use pivot tables that are not tied to the slicer.
  • A blue data bar that shows the average numbers of weeks on the chart by genre. These data bars are static and are not tied to the slicers.
  • A red data bar that shows the # of Unique Artists by genre for the selected decade(s). This required a DAX Measure with =COUNTROWS(Distinct(Table1[Artist])). This data bar uses one of the new feature in Excel 2010 where the data bar runs right-to-left. This is a cool feature for creating comparative histograms.
  • A set of 10 Win/Loss Sparklines that show year-by-year history for the top 10 artists. (Top 10 is based on song-chart-weeks. If Elvis had 10 songs on the chart for 10 weeks each, that would count for 100 chart-weeks.) More about this sparkline later.
  • The range F3:J18 contains some SmartArt that is dynamically refreshed to show (a) the top 3 genres for the selected decades, and (b) the top 3 artists in those genres for those decades. Now, since SmartArt is always static and never dynamically updated, this one was quite a trick.
  • The range E19:M23 contains a Tag Cloud of the top 10 artists for the selected decade. More about this one later.

A Bit About the Data

The data set was ugly. There were 20 columns of identifying data that provided year, genre, artist, title, beats per minute, followed by 67 columns listing the rank of Week 1 through Week 67. The original data set went back to 1890. Since I eventually hoped to publish a non-PowerPivot example on my public SkyDrive, I trimmed the data down dramatically. I added some calculated columns to count the # of weeks on the chart, the peak, a calculation to look for songs that hit #1 and other songs that peaked at #2 (see the “First Loser” chart on the SkyDrive version). I added a calculation in Excel to calculate the Decade. I deleted the song titles since this would screw up the Vertipaq compression and I did not plan on reporting at that level of granularity. I deleted the 67 columns of weekly data. The final file was 29K rows x 17 columns.

Initial Pivot Tables

My first pivot table had genre in the row area. Chart Weeks was in the value area, sorted descending. From this, I learned that Rock, Vocal, Country, Rap, and R&B were the top genres since 1950. I initially created a single chart showing all five lines, but then I used a trick from my Charts & Graphs book where four smaller charts can communicate more information that one large chart. These four charts became the first visualizations in the top left corner of the dashboard.

blog3

Creating the Sparklines

Sparklines are new in Excel 2010. Professor Edward Tufte imagined Sparklines as tiny, intense, word-sized charts in his book, Beautiful Evidence. As I was working on my book for Excel 2010 charting, I started to realize that (a) the best sparklines are larger than a single cell, (b) benefit from outside labels, and (c) benefit from manual gridlines.

In the image below, you can see that Elvis Presley had a song on the Hot 100 every year from 1958 through 1977, then hit the chart again in 1981, 1982, and 2004. In the second row, Elton John charted every year from 1970 through 2001, except for 1987. Fascinating stuff, right?

To make a sparkline larger than normal, you can increase the height and width of a cell. If that is not possible, then you can merge cells. (As MrExcel, I despise merged cells and I am a bit horrified that I am actually suggesting that you merge cells, but merged cells let you fit a lot of sparkline information into an area). In the screenshot below, cells B25:M25 are merged into a single cell and represent a single sparkline. Cells B26:M26 are merged into a single cell. I had to keep merging each row one at a time.

blog11

The data for the sparklines are off to the right of the screen. There are years from 1958-2009 stretching across the columns. A count of the # of songs by artist occurs in each cell. These Win/Loss sparklines actually need a positive number for the green marker and a negative number for the red number. I ended up using (# of Songs*2)-1. This would force cells with zero to become -1. Cells with 1 would still report 1, and songs with 2 would end up reporting 3, but I didn’t care, as all I wanted was positive or negative values.

The labels for 1970′s, 1980′s, through 2000′s in white are text boxes that I added manually. The dotted white lines that separate out the decades are Excel drawing tools added with the Insert tab. (Tip: Hold down the shift key while drawing the line to make sure it is perfectly straight. Once you get the first line drawn in, use the Drawing Tools Format tab to change the fill color to white and use a dashed line. Once you get the first line drawn in, Ctrl+Drag to make identical copies of that line.

Creating the SmartArt

blog4 SmartArt is new in Excel 2007. Use the SmartArt icon on the Insert tab in Excel. That is a Vertical Chevron List. I created the SmartArt with “Country” as the Level 1 text in each shape and “Bruce Springsteen” as the Level 2 text three times inside each shape. This is all just dummy text to allow Excel to size and shape the SmartArt. I used the SmartArt tools to apply a style and colors.

I created a pivot table that has Genre and Artist as the Row labels and Chart Weeks in the Values area. Both of those fields are set to use a Top 10 Filter to show the top 3 items based on Chart Weeks. This pivot table uses the Decade as a slicer.

Formulas point to that pivot table to build the text that should show up inside the SmartArt. The formula for the first Genre chevron is simple: =AT40. The formula for the three bullet points next to the first chevron is more complicated: =AU40&CHAR(10)&AU41&CHAR(10)&AU42. Those CHAR(10) are line feed characters and translate to bullet points when applied to the SmartArt.

Once you get the SmartArt looking just right, follow these steps:
a) Click inside the SmartArt to select the SmartArt and display the SmartArt Tools Design tab of the ribbon.
b) On the right side of the ribbon, choose Convert to Shapes.
What did this accomplish? Well, SmartArt which is new in Excel 2007 can not do one simple trick of Shapes which have been around since Excel 97. The text in SmartArt is static. In contrast, the text in a Shape can come from a formula in another cell.

You are going to do these steps 6 times:
a) Click on the text box inside the first Chevron. You want the bounding box to be solid, not dotted. If you get a dotted text box, click on the dots to make it solid.
b) In the formula bar, type an equals sign and point to the cell which will contain the first genre.
c) Press Enter.
You now have a dynamic text box on the shape.

Repeat for the other 2 genres and for the three text boxes that contain the top three artists.

Creating the Tag Cloud

Of the whole entry, I like the tag cloud the best.

I will have to try to build an animated GIF showing the SmartArt and the Tag Cloud as you choose various combinations of decades in the slicers.

Here is how to create a dynamic tag cloud using PowerPivot. AGCPost01The underlying pivot table has the Top 10 artists based on Chart Weeks, using More Sort Options to keep the data sorted high to low. The pivot table respects the decade slicer. The pivot table is nothing special, as shown here.

I noticed that many artists were in the database as “Beatles, The”. I wanted to get rid of the word “The”. So, below the pivot table, I used =SUBSTITUTE(AZ40,”, The”,”") to remove the comma and the word “The”.

AGCPost02 This screenshot shows how AZ63:BD63 is merged and uses a formula to point to the original pivot table.

In this new section of the worksheet, I bumped the top artist up to 36 point bold.

It is important to make the Fill Color for those 10 cells to be No Fill. This is the only way to make the area around the words be transparent when you create linked pictures.

Change the color of each value to another color.

Make the #2 artist a bit smaller, and progressively smaller as you continue down the list.

To build the Tag Cloud, you are going to use something that old-time Excellers know as the Camera Tool. The command sequence no longer uses the words “Camera Tool” anymore. Here’s what you do:

Select AZ63 and press Ctrl+C to copy that cell.

blog14 Go to the tag cloud area. Use the Paste dropdown on the Home tab and choose Linked Picture from Other Paste Options. This creates a picture of the top ranked artist. The background of the picture is transparent, so the orange color shows through.  (Technical problem: I changed the decades chosen in the slicer between the R. Kelly item above and the Madonna item at left).

Continue copying each individual cell and pasting as a picture. Arrange the pasted pictures in a somewhat random fashion, trying to keep the words from overlapping. The net result is that as you choose decades from the Slicer, the 10 artists in the Tag Cloud automatically update.

Here is the tag cloud for the 50’s:

blog12

Here is the tag cloud for the 80’s+90’s:

blog13

So – there you have it – a lot of basic Excel blocking and tackling, along with a bit of cool DAX measures to calculate the number of distinct artists in a genre. Again, please take a moment to visit the contest and vote for your favorites.

Will this Work On the Server Version?

Rob and I had a discussion this morning about the running this on PowerPivot Server. Since both the tag cloud and the SmartArt replacement are using shapes, none of those will render in Excel Services. Thus, this is a client-only solution for now.

Technorati Tags: ,,,

-Bill Jelen


The Superheroes of DAX, and derived measures

February 19, 2010

DAX Heroes

 
 

“Did someone say DAX?”

 

 

 

I wanted to start today’s post with a quick thank-you to the guys who tirelessly answer my DAX questions.

Marius Dumitru, Howie Dickerman, and Karen Aleksanyan.  You guys rock.  Thanks again for your patience educating me.  I’ll do my best to pay it back by sharing knowledge here.

(There’s no resemblance in real life to these three pictured above.  Well, except perhaps for Mr. Furious.  But it’s just an awesome movie and had three superheroes, which is rare – superheroes tend to be packaged in even-numbered groups.)

Today’s Tip:  Deriving measures from others

Today’s tip is a short lesson but boy is it helpful. 

Let’s say you have a fairly sophisticated measure like the “Number of unique products sold at number of stores” measure that I demonstrated the other day using SUMX().  And now you want a new version of that measure that only counts a specific type of product, as opposed to all products.

Copy/Paste the original measure formula?

Do you copy/paste the formula for the original measure into a new measure to make your edits?  I recommend against it, for two reasons:

  1. You are now nesting an additional level of logic inside an already sophisticated formula – this makes things less readable and harder to debug (especially since v1 PowerPivot does not let you “trace into” a formula step by step.
  2. Maintenance-wise this is a hassle going forward.  If you ever change the base measure, you need to change all copies of it as well.  Tedious.  And it’s even worse if you forget to change one of the copies.

Better answer:  use FILTER() against the original measure

You can avoid both of those problems with the following syntax:

    [New Measure] = [Original Measure] (<Table Expression>)

The simplest example of a table expression is to use the FILTER() function.  Let’s say we want our original measure, but only to count transaction of product type = fruit:

    [New Measure] = [Original Measure] (
                      FILTER(DataTable[ProductType]=”Fruit”)
                    )

Try it out!

Trust me, it works :)   And you will love it :)

Other flavors

I’m pretty sure that any expression which returns a table is valid as the <Table Expression>. 

EX:  I used CALCULATETABLE and it also works great.  CALCULATETABLE is like FILTER but allows for any number of filter params, whereas FILTER only gives you one.

    [New Measure] = [Original Measure] (
                     CALCULATETABLE(
                      DataTable[ProductType]=”Fruit”,
                      DataTable[Weekend]=”True”
                      )
                     )

Have fun everybody.  Catch you next week.


SUMX() – The 5-point palm, exploding fxn technique

February 16, 2010

 
Pai_Mei

 

 

“AGAIN!”

-Pai Mei

 

 

 

SUMX() – the great iterator

Have you ever written an array formula in Excel?  (Don’t worry, most people haven’t).  Have you ever written a FOR loop in a programming language?  (Again, don’t worry, there’s another question coming).  Have you every repeated something over and over again, slowly building up to a final result?

That’s what SUMX() does.  It loops through a list, performs a calc at each step, and then adds up the results of each step.  That’s a pretty simple explanation, but it produces some results in pivots that are nothing short of spectacular.

Anatomy of the function

     SUMX(<Table>, <Expression>)

THE BRIDE: “What praytell, is a five-point palm, exploding function technique?”
BILL: “Quite simply, the deadliest blow in all of the analytical martial arts.”
THE BRIDE: “Did he teach you that?”
BILL: “No. He teaches no one the five-point palm, exploding function technique.”

That’s kinda how I feel about the description of SUMX in the Beta release:  “Returns the sum of an expression evaluated for each row in a table.”  It merely hints at the power within.

Oddly, the best way to show you what I mean is to start with some useless examples and then build up to useful ones.  For all examples, I will use the following simple table, Table1:

Sample Table for SUMX Table1 

Useless Example #1:  By the whole table

     SUMX(Table1, Table1[Qty])

Returns:  35, which is the total of the Qty column.  Might as well just use SUM([Qty]).

Why:  Well, it iterates over every row in Table1, and adds up [Qty] at each step, just like the description says it would.

Useless Example #2:  By a single column

     SUMX(Table1[Product], Table1[Qty])

Returns:  An Error

Why:  Table1[Product] is not a Table, it’s a Column.  And SUMX demands a Table as the first param.

Useless Example #3:  By distinct values of a column, sum another

OK, I’ll wrap the [Product] column in DISCTINT(), since that returns a single-column table:

     SUMX(DISTINCT(Table1[Product]), Table1[Qty])

Returns:  An Error

Why:  [Qty] is not a column in the single-column table DISTINCT([Product]).  Only [Product] is.  Why did I even try this?

That’s where I gave up awhile back.  Until I learned…

Almost-Useful Example:  The Second Param Can Be a Measure!

And even better, that measure CAN access other columns even if you use DISTINCT.  First let’s define a [Sum of Qty] measure:

     [Sum of Qty] = SUM(Table1[Qty])

And then re-try the previous example with the measure, not the column:

     SUMX(DISTINCT(Table1[Product]), [Sum of Qty])

Returns:  35 Yes, the total, again.   But this time, the “Why” is worth paying attention to.

Why:  Let’s step through it.  Remember, for each value of the first param, SUMX evaluates the expression in the second param, and then adds that to its running total.
Distinct Products

Step One:  SUMX evaluates DISTINCT([Table1[Product]) which yields a single-column table of the unique values in [Product]:

 

Step Two:  SUMX then filters the Table1 (not just the [Product] column!) to the first value in its single-column list, [Product] = Apples.

Table1 Filtered to Apples by SUMX
Then it evaluates the  [Sum of Qty] measure against that table, which returns 17.

Steps Three and Four:  The process repeats for Oranges and Pears, which return 13 and 5:

Table1 Filtered to Oranges by SUMX

Table1 Filtered to Pears by SUMX
Last Step:  SUMX then adds the three results it obtained:  17, 13, and 5, which yields 35.

A lot of work to get the same result that the [Sum of Qty] measure can get on its own, but now that you know how it operates, let’s do something else.

And now, the Useful Example!

Let’s define another measure, which is the count of unique stores:

     [Count of Stores] = COUNTROWS(DISTINCT(Table1[Store]))

For the overall Table1, that returns 2, because there are only 2 unique stores.

Let’s then use that measure as the second param:

     SUMX(DISTINCT(Table1[Product]), [Count of Stores])

Distinct Products

Step One:  same as previous example, get the one-column result from DISTINCT:

 

Step Two:  filter to Apples, as above:

Table1 Filtered to Apples by SUMX

…and the [Count of Stores] measure evaluates to 2 – 2 unique stores have sold Apples.

Step Three:  Oranges

Table1 Filtered to Oranges by SUMX

…again, the measure evaluates to 2.  2 unique stores sold Oranges.

Step Four:  Pears

Table1 Filtered to Pears by SUMX

…hey look, only one unique store sold Pears.  So the measure evaluates to 1 here.

Last Step:  Add them all up.  2 + 2 + 1 = 5.  SUMX returns 5.  This basically means that there are 5 unique combinations of stores and products that they sell.

Why is that useful?

Well, I can’t share the precise case I was working on, because it belongs to a reader’s business.  But trust me, you are going to find yourself wanting this sooner or later.

Things to keep in mind

  1. SUMX responds to pivot context just like anything else.  So if you slice down to just a particular year, your results will reflect only what Stores sold in that year.
  2. AVERAGEX, MINX, MAXX, and COUNTAX all work the same way.  So if you want to iterate through just like SUMX but apply a different aggregation across all of the steps, you can.  Those would return (5/3), 1, 2, and 3, respectively in our example.
  3. The fields referenced in SUMX do NOT have to be present in your pivot view.  In my case, SUMX was working against [Store] and [Product].  But my pivot could just be broken out by [Region] on rows and sliced by [Year], and the measure still works.  (I like to think of it as a stack of invisible cells underneath each pivot cell that you can see, and SUMX is rolling up a lot of logic across those invisible cells to return a simple number to the top cell you can see.)

More to come!

Yeah, I am not even done with SUMX.  Like Jules told you, it’s some serious gourmet DAX :)


DAX: I’ve been shortchanging you

February 15, 2010

You Had Me at Calculate

Mmmm! Daaaamn, Jimmie! This is some serious gourmet DAX! Usually, me and Vince would be happy with some freeze-dried Taster’s Choice right, but he springs this serious GOURMET DAX on us!

-Jules Winfield

 
 
 
What I’ve seen so far is great, and yet…

The things I have done with DAX so far are a HUGE boost to what I can do in Excel formulas alone.  Here are some of the functions I have explored to date:

  1. RELATED – a faster, simpler VLOOKUP.
  2. CALCULATE – the big Kahuna.  A version of SUMIFS that I can use in a pivot measure to remove, alter, or override pivot filters and just aggregate the source rows that I want.
  3. ALL – the ability to strip pivot filters from certain fields or tables during a measure calc, enabling very flexible custom ratios when combined with CALCULATE.
  4. DISTINCT – returns the set of unique values of a particular column within the current pivot filtering context, very useful (so far) when combined with COUNTROWS.
  5. COUNTROWS – no more need for finding the unique-valued column in a current context, you can just count the source rows that meet current filter criteria.

But I’ve seen some things over the past week that made me realize:  I’ve been lax…  about DAX.

I just found a cupboard full of “gourmet DAX”

Funny thing folks:  in many ways, I am learning right alongside of you when it comes to DAX.  When I left Redmond in August, DAX was just starting to appear in the internal builds.  So while I was getting a little bit of an advanced look, in other ways I’ve been watching the DAX movie in progress just like everyone else.

Last week, a reader asked me a series of questions basically saying “can you do this in DAX?”  These were crazy things they wanted to do – VERY useful stuff for them, and totally understandable why they wanted it.  And my initial answer was “um, no, DAX can’t do that.”

I was wrong.  DAX very much CAN do those things.  And many, many other things I had not considered.  I’m a little embarrassed by holding out on you guys, but I’ve been holding out on myself, too.

I mean, I knew I had not yet dived into the time intelligence stuff.  Other people are doing a decent job of that, and my intent was to build up to it, slow and steady.  But I was missing other things, too.

New resolution:  at least two DAX posts a week

This is a long time coming really.  It’s time to devote a much bigger chunk of my efforts toward educating everyone – myself included – on the capabilities and finer points of DAX. 

Here’s a quick preview of what’s in store for us:

  1. SUMX() – the FOR loop of DAX, kinda like Array Formulas in Excel
  2. CALCULATETABLE() – generate a custom filtered table, on the fly, and then use that as the table argument to another function
  3. Using one measure as an input to defining another – self explanatory in some ways, but you won’t believe how often this gets you out of a jam.
  4. Using a different formula at one level of a pivot vs. another – just one example of something you can do by combining some of these techniques.

Seriously, I am excited.  I’m like a kid who’s discovered a secret room in the castle.


Sweden: the full videos

February 15, 2010

In case you missed them, the full videos of my presentation in Sweden were posted last week.

They are long – I was on stage for over two hours combined, despite running into that problem where a mandatory system update locked up my laptop and prevented me from showing the last segment :(

This was my first presentation to a “DB Pro” audience, and I learned a lot about how to tune future presentations to that crowd.

Videos here:

video4


Use datamining with PowerPivot in Excel

February 13, 2010

governor-arnold-schwarzenegger

“For me life is continuously being hungry. The meaning of life is not simply to exist, to survive, but to move ahead, to go up, to achieve, to conquer.”

-California Governor, Kasper de Jonge

UPDATE:  The technology in this post has now been taken over by Predixion Software.  To learn more, see more recent posts here and here.

Much as Tommy Chong reminds me of Donald Farmer, every time I watch one of Kasper’s videos, his voice inspires a very imposing picture.  I can’t help but think of Arnold, or Dolph Lundgren.

The man is a basketball fiend, too, so I imagine him being 7 feet tall, like a cross between Arnold, Dolph, and Yao Ming.  But then I find out things like he uses a Tolkien-inspired name on Skype, and, like me, played a Rogue in World of Warcraft for a few years.

And that’s when I realize:  oh yeah, he’s MY kind of people.

But the quote above is suitable for Kasper.  He never stops pushing the envelope.  No one asks me more questions than Kasper, or is exploring the boundaries of PowerPivot more enthusiastically.

So it’s appropriate, then, that I found that picture on a site in the Netherlands.  It’s also appropriate that he be the next guest poster on this site.  Check out Kasper’s Blog if you haven’t been following him.  And now, on to a killer technique by Kasper:

Data Mining with PowerPivot

I’m currently talking to a client who is very charmed by the possibilities of PowerPivot to analyze data, one thing led to another and we came to data mining .. I got thinking wouldn’t it be GREAT if we could use the Excel data mining add-in on PowerPivot data (with DAX at our disposal). Rob and I agree that this would be a great addition to the powers of PowerPivot and we got very excited. After some sparring with Rob I found a way! Rob asked me to do a guest blog post at PowerPivotPro with the outcome of my research.

In this screencast i will show you how you can use data mining with PowerPivot data:

Think about the possibilities we have, make some great calculations with DAX to make a calculated column or measures and then unleash the power of the data mining add ins !

A few prerequisites: since the data mining add-ins are 32-bits you have to install the 32 bits office 2010 with 32 bits PowerPivot. I hope they launch a 64 bits Excel 2010 version soon!
You have to have a SSAS (2005/2008 /2008R2)  instance installed on your network, not the in memory PowerPivot instance but a regular version, to use the data mining models in SSAS.

I used this video to guide me in the demo’s Introducing the Table Analysis Tool for Excel 2007.

And you can download the Excel data mining add-ins here (more videos in there to see the possibilities).

UPDATE: The SQL Server Data Mining team is working to extend the power and ease of use of SQL Server Data Mining to the Cloud. You can use this add-in to run datamining against a service in the cloud, you don’t need a SSAS instance installed ! Check it out on this page: http://www.sqlserverdatamining.com/cloud/


Captain Ramius: Epilogue

February 12, 2010

Sean-Connery-The-Hunt-for-Red-October The worry is the Americans. We meet the right sort, this will work. But if we get some… buckaroo…?

-Captain Marko Ramius
aka “The Vilnius Schoolmaster”

 

A feel-good ending :)

You recall the guy who became upset with me after thinking that my RSS link hijacked his Google Reader?  He turned out to be a very nice guy.  Check out this email reply from him:

> Okay, I am sorry for my rampage, and I am sorry for unmotivated(pretty much) personal attack to an unfamiliar person.(You can smack me in the face for that, next time you be in Vilnius.Once.) And I hope I did not do too much damage(I don’t think I did), for whoever asks in the future you can just forward this email. As for the "angry passage", well I was pretty sure that this another wise trick/form of advertising to increase visibility of the specific website such as PPP or smth, it kinda gets on your nerves when you realize that the same webpage, no matter what you do, appears first when you open your GR/referesh/do whatever, for a week or so. Obviously,I should have contacted you in person first. Obviously.

> As I said, I regret my actions, and appologise. I’ll do some testing with other wordpress blogs, and will see if the behavior is the same.

> Then I will send "angry passage" to the WordPress. Haha, just kidding.

> Peace and have a good one. 
> Yours sincerely,
> The lunatic from Vilnius

How cool is that?  I died laughing at the “you can smack me in the face.  Once” part :)

And he also agreed that I could visit him if I ever find myself in Vilnius :)   So by keeping my cool about it, I discovered a pretty incredible person and made a new friend.  That feels pretty good.

By the way

Dick Moffat reported to me that he saw similar behavior the other day with Google Reader and another site.  Which brings me to the obvious conclusion:

Google fears PowerPivot.