PowerPivotPro

PowerPivotPro is Coming to Atlanta

March 20 - 22, 2018

Registration for 2018 Public Training is now open!

AVAILABLE CLASSES

**Use the discount code “3ORMORE” when signing up 3 or more people.

MARCH 20 - 21

Foundations: Power Pivot & Power BI

Instructor: Austin Senseman

Super charge your analytics and reporting skills with Microsoft’s dynamic duo. Designed to handle huge volumes of data, these tools will transform the way you work! Two Days in our class and you are EMPOWERED!

  • Learn Microsoft’s secret weapon behind Power Pivot & Power BI: DAX
  • Taught by Austin Senseman – PowerPivotPro Partner
  • You don’t need to be an IT professional – most of our students come from an Excel background
Atlanta Public Training Classes
Atlanta Public Training Classes

MARCH 20 - 21

Level Up Series: Advanced DAX

Instructor: Ryan Sullivan

The Advanced DAX Course was such a hit in the first half of 2017 that we’ve expanded the course to 2 days!

Overview

  • This advanced DAX training class is taught completely in Power BI Desktop
  • Students are encouraged to take our Foundations course and have hands on experience with the DAX language
  • Taught by Ryan Sullivan – Principal Consultant
  • Class material drawn from usage of Advanced DAX applications while consulting with hundreds of international firms

MARCH 22

Level Up Series: Power Query for Excel & Power BI

Instructor: Ryan Bergstrom

The second class in the series is our Level Up Series is Power Query for Excel & Power BI.

  • Students are encouraged to take our Foundations course and have hands on experience with Power Query in Excel or Power BI Desktop
  • Taught by Ryan Bergstrom – Principal Consultant and Trainer
  • We will cover common to unique business challenges made easy with Power Query’s data wrangling capabilities
  • Intermediate to Advanced Level Power Query best practices distilled into easy to understand patterns to apply to your most common business challenges
Atlanta Public Training Classes
PowerPivotPro Logo

 
image

Nice Pivot, But I Only Want to See Months Where Eight
or More of My Stores Went Negative!

***Update:  Technique Extended, Workbook available

In a followup post I have added a slicer that lets the report user control the minimum number of stores required, rather than fixing it at 8 like this post does.  Also, the workbook is now available for download.

Find both in the followup post, located here.

Tales from Remote Consulting

Awhile back I left my job to start a new company.  I’m not yet ready to announce what that new company is about – I’m working hard on that and you folks will be the first to know.  Spoiler:  it’s about PowerPivot and Excel.

But in addition to hard work, there’s also a lot of waiting involved in all of that.  I’ve been filling the gaps with training and remote consulting to keep my head in the PowerPivot game.

Remote consulting in particular is a lot of fun – people send me a workbook, I spend 1-3 hours and build what they want, then send it back.  Gives me a good sampling of the problems that are “out there.”

One of those remote consulting jobs featured the problem pictured above (except that they had real data, and what I’m showing is 100% fake).

How Many Stores Fell Below Zero Each Month?

“In the pivot above, I only want to show Months where at least eight stores were negative.”

That’s one of the problems I solved for a reader whose initials are PR Smile

So how do we count how many stores went negative?

COUNTX Says “I’m a Strange Function, Only Use Me With Blanks!”

The first time I figured out SUMX (aka the 5-point palm exploding function technique), I remember looking at COUNTX and thinking “how the HECK is THAT function ever going to be useful?”

I mean, SUMX basically says “go evaluate an expression a bunch of times and sum up the result.”  So COUNTX means “go evaluate an expression a bunch of times and then count how many times you did it???”

I mean, aren’t these two formulas going to return the EXACT SAME RESULT?

  COUNTX(VALUES(Stores[StoreName]), any measure you choose)

  COUNTROWS(VALUES(Stores[StoreName])

Remember, the X functions are “loops” – they run through every “row” in that first argument – VALUES(Stores[StoreName]) in this case – and evaluate the second argument, which is typically a measure expression.

So if you have 15 total stores, COUNTX is going to evaluate your measure expression 15 times.  Won’t COUNTX always return 15 then?

Yeah, except when your measure sometimes returns BLANK().  Blanks will NOT be counted.  And we can do sinister, amazing things with that.  Get your evil scientist laugh ready.

Putting COUNTX to Work

Let’s write a new measure:

[Negative Growth Stores]=
  COUNTX(VALUES(Stores[StoreID]),
          IF([SameStoreSales]<0,1,BLANK())
        )

This says “loop through Stores and count the number of times [SameStoreSales] was negative.

Let’s try that out on a pivot:

image

It’s Working, But Now How Do I Use It?

Filtering!

OK, now we slap a values filter on Rows so that we only see months with 3 or more negative stores…

image

image

Yielding…

image

So Far So Good – Filtered to Just Months With 8 or More Negative Stores!

Remove that Measure From Pivot, Add [SameStoreSales] Back

But I don’t want to see the number of negative stores, I just want to filter by it.  I want to see the [SameStoreSales] value for each store!

No problem:

image

[SameStoreSales] and [Store Name] Back on the Pivot,
[Negative Growth Stores] Removed but Still Filtered!

Neat huh?

I’ll extend this technique with some additional tricks next week.

  Subscribe to PowerPivotPro!
X

Subscribe

Rob Collie

One of the founding engineers behind Power Pivot during his 14-year career at Microsoft, and creator of the world’s first cloud Power Pivot service, Rob is one of the foremost authorities on self-service business intelligence and next-generation spreadsheet technology. 

This Post Has 8 Comments

  1. Looks nice, but I’m hoping the snapshot you’re showing isn’t the whole picture (width-wise) as the months shown on the bottom picture have fewer than 8 stores in the negative for some months. Also that formula and the picture are misleading (in my interpretation). Your description was to show (loop) the number of times same store was negative. I’m seeing 0% and positive values. So why is it showing everything? I ain’t no expert (yes that’s fancy speak) but that just don’t look right for what I think you should see. BUT.. I have been known to be wrong before. Just don’t tell my wife.

    1. Yeah the report is 33 columns wide – there are 33 stores total. So yes, many negative stores are missing from the screenshots. I really need to switch this blog to a widescreen format 🙂

      The *measure* loops through the stores and counts them up. But the *filter* removes *months* that don’t have 8 stores negative. All stores are displayed no matter what. Does that clarify?

  2. I am unable to use this workbook in my Excel 2013 as it says something about needing to upgrade. My presumption is that the workbook starts with the raw data and I can follow through with your post to achieve your results?

    thanks

Leave a Comment or Question