Friends at a company play pickup basketball during their lunch hour. Since there are no established teams, players can be randomly matched up. But these folks happen to be engineers/datanerds, so they keep detailed track of games, teams, players and win/loss. The diagram view of the data is shown further below.
Question: How can we determine which player pairing is the most successful?
Since players are randomly teamed up, are there combinations which when teamed up have an unusually high winning percentage?
Word Cloud of Player Nicknames: Size of text indicates number of games played
Application: This would naturally extend to other sports, but I believe may also apply in many nonsports scenarios, where items are paired up somewhat randomly (or by design) and we want to know how effective those pairings are.
Thanks to Kirill Perian (basketball nickname KReal), an attendee of one of our past webinars, who sent us the dataset and posed this question. Dataset has been simplified to showcase this scenario and anonymized to protect the identity of the losers
File can be downloaded here.
Model Diagram: Showing Game, Team and Team Players
First we will address the easier scenario of creating metrics for individual players, using the manytomany pattern. Next we will take on writing measures to compare performances of pairs of players.
Let’s start with a really simple metric, count of games played.
GamesCount:=DISTINCTCOUNT(GameTeam[GameID])
This works until we attempt to use a field on the other side of the many to many relationship.
Measure breaks (repeats) when we use a field from Player Table
Between Player and Game, there is a many to many relationship. One Player can play in many Games and one Game would have many Players. The way to map this in Power Pivot is using a bridge table as we have done here using GameTeamPlayer. See model diagram above.
We are not even going to break a sweat solving this one. Been cracked a long time ago, thanks to thinkers like Jeffrey Wang and Gerhard Brueckl. Here is our new measure, see image below for explanation. Read the linked articles, if you really want to divein. For most folks I would recommend understanding this as a pattern using image below and simply applying it. (Never heard the “downhill” “uphill” terminology in relationships, for $10 buy the digital version of our PowerPivot DAX book. Would be the best $10 you ever spent).
GamesPlayed:=CALCULATE([GamesCount]), GameTeamPlayer)
You can see, in the Pivot image below, that the new *magic* measure is working and we have also added some basic additional measures to show games won, lost and win percentage.
New *magic* Measures work perfectly across a ManytoMany relationship
Metrics for individual players were relatively straightforward. But how do we write measures for pair of players? After some head scratching it became clear that I needed another Player table. I left the original Player table alone and added a PlayerA and PlayerB.
PlayerA and PlayerB added with “Inactive” Relationship
I created relationship between GameTeamPlayer and PlayerA/PlayerB, but as you can see by the dotted lines that both relationships are marked as inactive. You can do so from the Manage Relationship window. Why inactive? That will be apparent soon. For now just go with it.
To get us warmed up to the idea of inactive relationship, let us write the GamesPlayed version for the PlayerA and PlayerB tables as below. (Shown for PlayerA; PlayerB works in similar fashion).
PlayerAGamesPlayed :=CALCULATE (
[GamesPlayed],
USERELATIONSHIP ( GameTeamPlayer[PlayerID], PlayerA[PlayerID] )
)
You can see when we put PlayerA on the pivot, while the original GamesPlayed measure does not work (just repeats the same number), PlayerAGamesPlayed shows the correct number. USERELATIONSHIP in effect marks that relationship as Active, during the computation of this measure.
USERELATIONSHIP makes our Measure work!
For the final measure, we are going to repeat the *magic* manytomany pattern above with some changes
Step A: We still need to refer to the “downhill” table: GameTeamPlayer.
But we need to refer to it in two versions
GameTeamPlayer Version 1: Filtered using relationship with PlayerA 
GameTeamPlayer Version 2: Filtered using relationship with PlayerB 
Step B: Next we need to combine these two version in an “intersect”, so we only count the games that they played together
Intersection of two versions of GameTeamPlayer would lead us to Games Played Together
Here is the formula (lines numbered to aid explanation):
Lines 2 & 3 accomplish Step A, giving us two filtered versions of the same table (remember Schrodinger’s Cats/Pivots?). Line 1 has the CALCULATE which accepts the two tables as parameters and combines them to get us the intersection. Note that we use our original measure GamesCount, which to remind you, is defined as below:
GamesCount:=DISTINCTCOUNT(GameTeam[GameID])
So technically the “intersect” happens at the GameTeam table, where the arithmetic is being performed. That also explains why we left the relationships as inactive. Else, if you think about it, there is really no row on GameTeamPlayer where say Player=”Bad News” and Player is also “BandAid”. Don’t make that hurt your head too much. If you feel like you understand the overall pattern and can apply it, that’s all you need. I’ll admit my own understanding ebbs and flows.
And here is the resulting pivot:
New Measure determines Games Played Together
for all combinations of PlayerA and PlayerB
Let us quickly validate the result. We will do that for players “Melo” and “Mini Lebron” who have relatively few games thus making it easy for us to check the data.
In the image below, we can see the measure PlayerABGamesTogether, and using a detailed pivot can validate that indeed, there were three Game Teams where these two played together.
There were three Game Teams where these players played together
So who is the dominant pair? Looking at data just for KReal, the pairing of KReal and Butch stands out. Of all the 164 games KReal played, they were paired for 51 and have a winning percentage of 73%. Which is markedly higher than KReal’s other pairings!
Butch happens to be O. Tre. Kirill, let me know if that sounds right?
KReal and Butch pairing stands out in terms of Win percentage
The formula used is adapted from the Survey pattern by the Italians (they are the Gods!).
File can be downloaded here.
Autorefreshes Your Power Pivot Workbook as Frequently as Desired, AutoPublishes to Any Location, and Now Sends Email Notifications of Success/Failures – With Attachments!
The team has added several new features in the latest version of Power Update. One of them (email notifications that optionally attach the updated workbook or PDFified version of the workook), is pictured above.
But the biggest new “feature” is that there’s now a 100% free version. Go ahead and download it from the link below, and start using it today.
It will work forever – no trial expiration – and will never require payment.
GET THE FREE VERSION HERE
(Alternate Location Here – in case DropBox is blocked)
It will be installed and working in less than five minutes. Have fun, and if you have any troubles, report those on the Power Update Forum.
Simply put, we want everyone to have it. Everyone. It’s a game changer. It will lead to more Power Pivot / Power BI adoption and overall goodness, which is very much something we want.
The only limitation in the free version is that it will only schedule one workbook. Every last feature is available – email, PDF attachments, publish to SharePoint and even SSAS Tabular.
So if you’ve only got one important workbook, you can use the free version forever. A lot of people will run that way, and we’re ok with that. If you someday end up with more than one workbook that needs refresh, you can opt to purchase the full version, which can schedule as many workbooks as you want.
Yep, if you’ve got multiple computers, go ahead and install the free version on ALL of them. Use each computer to run a different workbook. Totally cool.
We WANT you to do that. We want Power Update running everywhere. At some point if you run out of spare computers, then maybe you buy a license or two. We’re ok with this loophole. Go crazy.
Most of the Other New Features Live on this One Dialog
The Options Dropdown is Where You Set Up Email
(But there are some other goodies lurking there as well)
Have fun folks
]]>Matt Allington, our friend from down under, had suggested the idea that we make some basic information available as course prep to students who enroll in our Live InstructorLed classes (Upcoming: Seattle Apr 12, Online Apr 67, see Choosing your training option). Offering a course prep would enable us to get to the real fun stuff even quicker. I have taken that to heart and publishing some information in this post below and a Course Prep playlist on our YouTube channel. This is meant as a prep for students enrolled in our class, but may be helpful to others as well.
Launch Power Pivot
Create New Measure (Calculated Field)
Edit Measure (Calculated Field)
Slicers
Insert a Pivot Table connected to Power Pivot Model
Add Excel Table to Power Pivot
Power Pivot Home Tab
Power Pivot Existing Connections
PowerPivot > Manage 
PowerPivot > PowerPivot Window 
PowerPivot > Calculated Fields > New Calculated Field 
(Must be inside a Pivot Table) PowerPivot > New Measure PowerPivot Field List > Right Click > Add New Measure 
PowerPivot > Calculated Fields > Manage Calculated Fields Select Measure > Click Edit… 
PowerPivot Field List > Right Click > Edit Formula… 
(From Excel) PowerPivot > Manage (to launch Power Pivot) (Within PowerPivot Window) Home tab > PivotTable 
(From Excel) PowerPivot > PivotTable 
PowerPivot > Add to Data Model 
PowerPivot > Create Linked Table 
Get External Data section is slightly different

(PowerPivot) Home Tab > Existing Connections 
(PowerPivot) Design Tab > Existing Connections 
Power On!
Avi Singh
In my last blog on PowerPivotPro.com I showed how easy it is to create a standard calendar for Power Pivot using Power Query. Most of my customers however don’t use a standard calendar but instead use a 445 calendar (which is very common in the Retail Industry). A lot of people shared with me their 445 calendars after my last post, and that reminded me that although the concept of a 445 calendar is very common, everyone seems to have different rules on how the calendar works.
Differences in 445 Calendars include
So there are almost as many permutations as companies and I don’t want to go down the path of trying to write 1 calendar that will work for everyone. Instead this post covers the techniques I used to solve the 445 calendar problem for one of my customers. If you are so inclined, you can copy these techniques plus some of your own to meet your own 445 needs. To give you an idea, it took me about an hour to think through the problems, research the functions and build a working calendar. If you copy my techniques, you should get a head start on that for your own 445.
The rules of this particular calendar are
Here is how I did it. But first a word of warning. The steps are easiest to follow if you first download the sample workbook (link at the bottom) and step through the Applied Steps as you read my explanations in this post. If you are not a Power Query expert and you just read the post, it will quite hard to understand. So do yourself a favour and download the workbook, and step through it as you read the post
First I added a list of dates making sure that the date I added was the first day of the financial year. I then added an ID column. I used the same techniques here as I discussed in my last post (including changing the end date so it is dynamic), so I wont cover it again here – the link is at the top of the page.
Then I inserted a Year ID column (1 for the first year, 2 for the second year etc). To make this work, I simply divided the ID column by 364 and rounded up. So each 364 days gets its own year number – this is how this customer’s calendar works – every year has 364 days.
This RoundUp trick is actually the key to this entire calendar – I have used it many times – so it is worth calling it out here. All I am doing above is dividing the unique ID number I created (1, 2, 3, 4……363, 364, 365, 366 etc) by 364 and rounding up. So
1/364 = a very small number which when rounded up = 1. 2/364 rounded up also equals 1, as does 3/364 etc all the way up to and including 364/364 also rounds up to 1. But 365/364 rounds up to 2 – hence it becomes the “second year”. You will see this pattern over and over below.
Now that I had a reference for which year we were in (first year, second year etc), I could create the Fin Year column. I simply used the starting date as I seeded above, converted it to a year (2013 in this case) and then added the YearID. In this calendar I am writing, the financial year value is taken from year end date – which is 2014 in this case. So the year of the starting date plus the value of the YearID = the Financial Year.
The next step required me to understand the 454 pattern. The 454 pattern follows a 13 week cycle, so I needed to be able to give each week a unique ID so I could use these ID numbers to map the weeks into the correct months. I used the same RoundUp trick I used above here. Just divide the original ID number by 7 and round up. This gives me unique number for each week across the entire calendar
I then created a “week of quarter” column. This one repeats from 1 to 13 and then starts again. I can use this to identify exactly which weeks go into the 454 pattern. This formula is a little different in that counts 1 through 13 and then restarts at 1 again. To do this, it keeps track of how many batches of 13 weeks have already passed using the RoundUp trick and then subtracting 1. So in the first 13 week period it subtracts 0 x 13 from the WeekID (leaving the numbers 1 through 13 for the week numbers. In the second batch of 13 weeks it subtracts 1 x 13 = 13 from the WeekID numbers, so instead of 14 through 26 you end up with 14 subtract 13 through 26 subtract 13, which is 1 through 13 again. The pattern just repeats.
Creating the MonthID was the trickiest part. I had to use 3 steps to do this. Power Query doesn’t have a “Select Case” concept. I Googled it and found one of Chris Webb’s blog posts on the topic. He wrote his own version of Select Case, but it looked too hard to me. So this is the way I did it. I referred to the Week of Quarter Column above. This column has numbers from 1 through 13, then starts again for the second quarter and so on. So using this column, I know that weeks 1, 2, 3 and 4 are in the first month, 5, 6, 7, 8, 9 are in the second month and 10, 11, 12, 13 are in the third month – the same applies for every quarter (your calendar may be different of course). So with this in mind, I added a column and put an IF statement that basically looks at weeks 1, 2, 3, 4 in the quarter only – it ignores weeks 5 through 13 totally. It puts a 1 in the MonthID Column for the first quarter, and then a 4 in the MonthID column of the second quarter, a 7 in the MonthID of the third quarter and so on. So this step is adding the month number for the first month of every quarter and ignores the second and third months.
This is the code it generated for me
Then I needed to repeat this process for the second and third months in each quarter, but this time I didn’t need to add a new column. So I had to work out how to hand write this line of code – my Power Query Language skill is not that good. So I used a little trick to get the Power Query UI to write the basic code for me, and then I could modify it for my needs. First I selected my column from the previous step that contained either numbers or null values, and then from the Power Query UI I selected Transform\Replace Values and selected to replace null with the number 2 (this is an arbitrary value that is not already in the list).
Using the UI in this way created the following line of code – so I didn’t have to write it. All I had to do then is edit this line of code and replace the 2 that I added in the wizard (ie the “replace with” value) with another IF statement like the one above.
So I literally just copied the IF statement from my previous step, pasted it in place of the number 2, and modified it to act correctly on weeks 5 through 9.
I just repeated the process for weeks 10 through 13.
Now I had the monthID, creating the Fin Month Number was the same process as creating the Week of Quarter, just using different values.
Same again for Fin Week Number
The Calendar week numbers are a simple integer shift from the financial week numbers. But I needed to use an IF statement because some of the numbers had to be shifted up, and some were shifted down.
Same with Calendar Month Number
Once I had the calendar month number in hand, I could create the month names. In this case the year and day don’t matter as I am only extracting the month name. There may be a better way to do this, but this works.
Lastly I added a Day Name column
This is what the table now looks like
Now I know there is an issue in that sooner or later there will be a 53 week year. I haven’t dealt with this issue in my query, nor will I need to for a couple of years yet
I then took a copy of the query and turned this new copy into a function. I took a copy so I didn’t accidentally mess up the work I had done already (which I have done before and it is hard to recover if you are new to the coding Power Query Formula Language).
To create a function, you need to add the code to accept the input parameters (1 and 2 below) and then replace the 2 references to the start date in the code with the parameter “YearStartDate” (3 and 4 below)
So it went from this
To this
After you save the function, you get the Invoke Function screen
Press the Invoke button and you get prompted for a date.
Enter 29/4/2013 and press OK. There you have your calendar. It works for any year not withstanding the 53 week issue I haven’t dealt with yet. And it automatically stops at yesterday’s date preventing calendar over run.
Now I have done all this work, I thought I would make a week calendar too. It is easy to do this using the day calendar I created. Just right click on the query workbook and select reference. This creates a new query linked to the first one.
I edited this new query to filter out all dates except Sundays (the last day of the week).
Finally I
And there I had a week version of the calendar as a bonus (I use week calendars all the time).
I gave the 2 function driven calendars names and loaded both to the data model. I kept the script version and disabled loading – I might need it later.
Then a file\Save As\Excel Template
Now when I want to create a new Excel workbook from scratch, just go to File\New\Personal and select the template from the list.
The 2 date tables are already in the new workbook – just delete the one you don’t want from within Power Pivot. And that’s it. You never have to worry about updating your calendars again, and don’t have to worry about the end date over running.
Here is a copy of the workbook I created.. I have the calendar tables loaded to the worksheet for demo purposes only, I only have it loaded to the Data Model in real life.
Matt Allington is a Professional Power Pivot Consultant based in Sydney Australia.
]]>Folks, thanks for attending our webinar. We did have a full house with 200 attendees. Here is how things started…
“Welcome to our webinar: Excel to power pivot: *BEEP* the gap. A lot of users *BEEP* Excel but don’t *BEEP* Power Pivot. We’re here to *BEEP* you up about the possibilities that Power *BEEP* offers…”
Okay, that wasn’t much fun. For some truly funny unnecessary censorship watch “This Week in Unnecessary Censorship” (Caution: If you’re at workplace, you might want to use headphones).
I did sort out the matter eventually with the help of Citrix Support. Apparently there were issues with the last automatic update of GoToMeeting software. Uninstall/Reinstall restored my ability to turn off those annoying beeps.
We published the Q&A from the last webinar and I’ll try to keep that up. So here’s the Q&A from the session on Mar 17th.
TIP: If you have other questions, use the search box. We have 750+ blog posts and most likely you will find something helpful
List of Questions (click to jump to answer):
Q: If the tables are not related, can you create a Pivot Table for each unrelated table separately?
Q: Why wouldn’t you use Microsoft Access instead?
Q: How can we automate the refresh of a Power Pivot report without using server components?
Q: How many rows/columns can Power Pivot handle? My data set is wide and flat
Q: How easy is it to share Power Pivot data with nonPower Pivot users?
Q: What are good practices for preparing the tables? The tables can have blanks, right?
Q: In my calculations, Can I exclude some of the rows where the information is not applicable and calculate for the remaining rows?
Q: Can we combine/leverage VBA with Power Pivot?
Q: How do you filter out certain fields to not bring in to PP?
Q: Why is PP not available on Excel 2013 Professional?
Q: Many questions around Date table and creating Date tables
Q: Other questions discussed
Q: Will webinar be recorded?
Q: If the tables are not related, can you crate a Pivot Table for each unrelated table separately?
D. van Eyl
It is very common to have multiple data tables distinct from each other in the same model. Example Sales data, Budget data, Inventory data, Website traffic data etc. It is valuable to keep these data sets in one model so you can analyze them together.
Your data model should not look like mushrooms where each data set has its own lookup tables
Multiple Data Tables should NOT look like mushrooms
It should look more like a web with a set of data tables and a set of lookup tables. With the data tables connected to the relevant lookup tables.
Multiple Data Tables should form an Interconnected Web with the Lookup Tables
Another scenario for “unrelated” tables is the Disconnected Slicer trick – where you use an unrelated table, but use DAX to harvest values and then control some Power Pivot behavior based on that. You would find many examples our blog for this technique: Search for Disconnected Slicer
This article is a good example: Simplifying Time Calculations and the User Experience using Disconnected Slicers
Q: Why wouldn’t you use Microsoft Access instead ?
S. Schwantes
When comparing plain old Excel to Power Pivot, I cited four key advantages (See Office Sway Infographic):
While Access does allow you to create relationships the other three points still apply. Power Pivot performs way better than Access. Better compression, lower file sizes, faster performance. Then of course, there is the DAX formula language and the Power BI toolset.
Let me make one other point, Power BI is the direction in which Microsoft is investing.
“Power BI is the future direction of Microsoft. You will be better served as a professional or an organization by going with Power BI than a different technology”
That is apparent from all the communication going out from Microsoft. One attendee of the Microsoft Convergence conference reported “Power BI” being mentioned numerous times by all key speakers including Satya; and of course James Phillips was there. And Convergence is not even a BI conference (Dynamics/ERP focused apparently).
Thus you will be better served as a professional or an organization by going with Power BI than a different Microsoft technology (or nonMicrosoft technology for that matter)
Q: How can we automate the refresh of a Power Pivot report without using server components?
B. Bryant
 With Server Option: Let me first speak about how you can refresh using the server options. The three server options are SSAS tabular, SharePoint, Power BI. Each of those would allow you to schedule an auto refresh. This article considers some advantages of going the server route.
 Without using the Server Option: The easiest way to refresh your workbooks is Power Update. It’s point and shoot in its ease of use. There is a trial version you can take for a ride.
Beside that you can use VBA macros or other programming to refresh your workbooks. You can read some comments about this on the Power Update page. Not for the novice though.
Q: How many rows/columns can Power Pivot handle? my data set is wide and flat
C. Switzer
In this webinar and the training classes we often throw around big numbers – million rows, hundred millions rows, billion rows. But the reality is, it comes with the fine print: Individual results may vary. I don’t want to make it sound like one of those latenight commercials, promising sixpack abs for everyone. Power pivot can truly handle an enormous amount of data. But you may need to optimize your data set.
A data set that is wide and flat is not the best shape for Power Pivot. To give your data sixpack abs, you need to go from flat to star.
“Give your data sixpack abs!”
Few ways of doing this, Power Query is perhaps the best. Watch the video here “Un”Flatten your data using Power Query or read this blog article Flat to Star Transformation using DAX Query.
Q: How easy is it to share Power Pivot data with nonPower Pivot users?
M. Hodge
Of course, you can always share your XLSX file with the Power Pivot model and Pivot Tables/Charts with anyone (via email or other means). The question is what functionality can be expected if user does not have Power Pivot and what would be the remedial options.
When Using 
Without PowerPivot… 
Comments 
Excel 2010 
User can open the file and view the Excel Pivots/Charts. But can perform no operations on the Pivots (filtering/ using slicers etc.) 
Power Pivot is a free install. So a minor annoyance but easily overcome. 
Excel 2013 
User can open the file. 
Excel 2013 has the “Data Model” builtin to all versions. It’s just the Power Pivot addin (the authoring environment) that is only enabled for ProPlus SKUs. 
Server Option 
User can view and interact reports using plain old Excel without Power Pivot. 
This is the way to go eventually. Read this article on Server Option. 
Q: What are good practices for preparing the tables? The tables can have blanks, right?
D. van Eyl
You have to pay special attention to blanks for the key/ID columns (e.g. ProductKey) used to connect your data and lookup tables in a relationship. Especially on the side of the lookup table. If you have multiple blanks in your key/ID column in your lookup table you would get an error when attempting to create the relationship.
“The relationship cannot be created because both columns selected contain duplicate values”
Everywhere else blanks are acceptable, but perhaps are still undesirable. For example if the product color is blank for 90% off your data set, it would not look good in pivot tables or charts.
Q: In my calculations, Can I exclude some of the rows where the information is not applicable and calculate for the remaining rows?
S. Raichura
Scenario A: There’s some erroneous data in your data set which always needs to be excluded. I would highly recommend removing those at the source or filtering them out when pulling that data set into Power Pivot
Scenario B: Data is not erroneous but just not relevant in some contexts. Example in our AdventureWorks data set, let’s say the head of bikes department is looking at reports. In her case, she may want to exclude everything but bikes. This you can do by
– Using a filter/slicer to filtered it out in the Reports
OR
– By defining DAX measures using CALCULATE that filter to only show the “Bikes” data
e.g. Bike Sales:= CALCULATE([Sales], DimProduct[CategoryName]=”Bikes”)
Q: Can we combine/leverage VBA with Power Pivot?
D. van Eyl & M. Duncan
I am glad you asked. Of course there is plenty you can do on the Excel side with Power Pivot driven model: See some VBA Examples
For specifically working with Power Pivot, read Adding tables to a Power Pivot model from VBA (in Excel 2013). Here is a quote:
“Can you build a model from scratch? Can you add a new table to an existing table? Can you add calculated columns? What about calculated measures? , Can you change a connection for an existing table in the model?
The short answer to these questions is Yes, Yes, No, No, Yes”
Q: How do you filter out certain fields to not bring in to PP?
M. Manning
Use Preview and Filter when importing data to either filter dataset or unselect columns you do not want to include in Power Pivot. Later you can go to Design > Table Properties to make the same changes for an table that already exists in Power Pivot
Click to enlarge image
Q: Why is PP not available on Excel 2013 Professional?
P. Garay
Sigh! We have raised our voice: see Change.org petition to Microsoft to “FREE” Power Pivot
Hopefully things will be straightened out for Office 2016.
D. van Eyl suggested “Protests @ Microsoft, Washington”
Q: Many questions around Date table and creating Date tables
Many ways to do this, starting with in plain old Excel.
Here are some recommended articles, just search on “Date Table” for more.
 Create a Custom Calendar in Power Query
 SQL Date Tables in Power Pivot
 The Ultimate Date Table–Revisited
 The Ultimate Date Table
 Using Query Editor to Create a Date Table
Q: Other questions discussed
 How does one get past an IT department that says “We cant do 64bit” …..sigh.
 How to show daily sales and MonthtoDate sales in the same Pivot?
 Is it possible to refresh the Power Pivot data automatically upon opening the file?
 Would you want to edit a date table to remove unneeded dates for performance improvement?
 Is it possible to extract an excel datafile directly from a webpage without having to download it?
 Bigger Power Pivot models with lots of measures tend to slow down in the authoring environment while Pivot still run at stellar speed
 Would Power Pivot work only with fact and dimension tables?
Q: Will webinar be recorded?
We do not record our webinar sessions. We recommend you subscribe to our YouTube channel, where we post recorded content about Power Pivot and Power BI. Or subscribe to our blog to stay notified about future webinar events.
]]>In the Classic Physics Thought Experiment, Schrodinger Hypothesized a Cat That Was Simultaneously Dead AND Alive.
(But here we will use the more humane “Simultaneously Green AND Grey.”
PowerPivotPro.com celebrated its 5th birthday back in November. Over 5+ years, we’ve progressively covered techniques with an increasing level of sophistication. That’s pretty natural – we ourselves have become more skilled over time, AND there’s a tendency to not want to write the same post twice.
But today I want to drive home a basic point, one that will help “recruit” Excel pros into the Power BI camp, AND that will help “crystallize” a few things even for the longtime DAX practitioners.
In 1935, physicist Erwin Schrodinger wanted to show Albert Einstein how wrong he was. Einstein had recently published a paper that made an astounding claim about the nature of subatomic particles. If those claims were true, said Schrodinger, even “big” everyday stuff, like cats, could also behave in that same outlandish way. Which made Einstein look kinda silly, in Erwin’s mind.
He proposed the idea of a cat that was both simultaneously alive AND dead, and basically said “See, Albert? Alive AND dead is clearly impossible, so your theory is junk.” See here for details.
But modern quantum physicists actually think the cat experiment does NOT disprove Einstein’s claim. In fact, they think Schrodinger’s Cat demonstrates that the universe is fundamentally a MUCH stranger place than we typically think.
In short, the concept of “impossible” is subject to reevaluation.
A Simple Little Picture Yes? But it Hints at a Quantum Shift in Analytical Power.
“The pivot pictured above is impossible,” says Schrodinger. Sorry, you just can’t do it. Nope, no way. The “Just Bike Sales” column is behaving as if the pivot is filtered to Bikes and the “Total Sales” column is behaving as if there’s no filter at all.
You CAN do that of course, but you can’t do it at the same time. You have to add a report filter (or a slicer) and then keep toggling it back and forth:
Just Keep Toggling the Pivot’s Report Filter Back and Forth
Sometimes this is fine, sometimes it’s clumsy.
Excel users are a clever sort, and sooner or later you realize we can just have two pivots:
Have You Ever Done This – Two Pivots of the Same Shape, But With Different Filters Applied?
I Sure Have.
And then, the next logical step: ingrid formulas to calculate the ratio or difference between the pivots!
You May Have Done This, Too.
(In this case I eschewed GETPIVOTDATA and used A1 ref, but have done it both ways – a lot).
You’re all done. You’ve built your multiple pivots, written your formulas, and present your results.
The first thing they say is “awesome, but we also need to see it broken out by X.”
You want to strangle “them.” Don’t do it, but I understand why.
Because when you add another field to the pivot, your ingrid formulas need to be rewritten, and sometimes you need to completely reorganize your worksheet because the pivots, as they change size, start colliding with one another.
So you tell them no, not possible in the time allowed. Which is often the absolute truth – a simple change like that quite frequently is a “start from scratch” situation.
This IS Possible, With Power Pivot and/or Power BI.
Just a simple little formula:
[Just Bike Sales]:=
CALCULATE([Total Sales], Products[Category]=”Bikes”)
One pivot, simultaneously behaving as if it’s filtered AND unfiltered – one column is, one column isn’t.
This is NOT possible with normal pivots. OK sure, you can add a calculated column in the original source data that contains 0 unless a sale is a bike sale, and the full amount if it is, and then you put THAT column on your pivot. But that takes forever, and litters your source data with dozens of columns over time. You know you CAN do it, but you DON’T do it – at least not very often.
But then we pile on, add another formula, and we’re off to the races:
[Pct of Sales from Bikes]:=
[Just Bike Sales] / [Total Sales]
Our Formula for Percentage is Now in the Pivot!
Added Weekend/Weekday on Rows, All Good
Our Formula Keeps Working Even though Its Inputs are No Longer Displayed ANYWHERE
Rearrange? Drag Country to Columns? No Problem.
Take a look at those last two pictures. In those pivots, EACH CELL is behaving simultaneously as filtered and unfiltered. It’s dividing the filtered amount by the unfiltered amount.
And honestly, this is one of the more MINOR examples of CALCULATE’s power. We could be here for a long time if I tried to show an exhaustive list.
Since 2009 we’ve been saying CALCULATE is a supercharged SUMIF. And Einstein would approve.
]]>Excel users are everywhere! Even at Toastmasters – a nonprofit educational organization focused on communication and public speaking. The other day, I had dropped in at our local Toastmasters as a guest, after a long break. It felt good to be back. The meeting had the familiar structure – speakers, evaluators, table topics. When it was over, as we were heading out, I struck up a conversation with another attendee. As members come from varied backgrounds, I didn’t know how technical I could get when describing my vocation. Thus, I spoke in general terms about my work at Microsoft, then leaving Microsoft to pursue a path of my own. And then I asked…
Me: So what do you do?
FTM (Fellow Toastmaster): Well, my job title says Quality Assurance, but that doesn’t quite describe what I do.
Me: Happens all the time, so what do you really do?
FTM: Well, I do a lot of data analysis.
Me (excited now): What tools do you use?
FTM: My company has a lot of data stored in these large databases, but they didn’t want to make a big investment in BI. So I just pull the data and analyze it in Excel.
Me: Did you know that Microsoft has released a new set of tools, called “Power BI”, which supercharges Excel?
FTM: Can it handle multiple data sources?
Me (trying to keep off the smug smile): Yes, indeed.
FTM: Can it handle large data sets?
Me (giving up now, a wide grin plastered on my face): It can do that and a lot more. You should attend one of our upcoming Webinars…
I have seen how transformative this path can be. From my own journey (read or watch) and from many others I have witnessed since joining PowerPivotPro. I believe the three steps below are needed to really set a person or organization on this path:
Typically after the third step, you have experienced the power and are motivated to pursue this path! But there are many who never make it to that step. My mission is to change that for as many people and organizations that I can.
Join me for our upcoming webinar tomorrow, where I lead you to the promised land
We’re planning the next event in April covering a new topic. Subscribe to our blog to receive updates on future events.
]]>Intro by Avi: I have often been asked, about ways to provide an “input” to the Power Pivot model from Excel. Disconnected Slicers are a popular way to do this. But with Excel and Power Pivot, there is always more than one way to accomplish a task. Dany shows us how, while making histograms easier to use. He uses a filter dropdown, which even works with Excel Online – inside a browser! Here is the end result, read on to learn how and download file.
Take it away Dany…
Creating a histogram in Excel based on Power Pivot is not as easy as it should be.
The method I use is no different from what others have already blogged and wrote about. There is even a solution that calculates the number of bins in a histogram with a formula that is based on the total number of cases.
My take on the problem was to let the user choose in run time what is the interval between each bin as a percentage and to show the number of bins accordingly.
The model contains data about a service that is in its infancy and so the users experience a relatively high number of errors.
The managers responsible for the service posed the following request:
“We want to see a histogram of the sessions showing how many users have experienced no errors in all the sessions they initiated, how many experienced errors in 10% of the sessions, 20% of the sessions … all the way to these poor users who saw nothing but errors in 100% of the sessions (Told you it is in early stage…)
We had a table with the Users, a table with Sessions and a table with Errors for Sessions.
The actual histogram was created by adding the disconnected table ‘Buckets’ for the bins and creating the following measures:
 Total sessions from the sessions’ table
Sessions:=DISTINCTCOUNT(Sessions1[SessionId])
 Sessions in error from the errors table
FailedSession:=DISTINCTCOUNT(Errors[SessionId])
 Fail ratio as a ratio between the previous two
Failure:=DIVIDE([FailedSession],[Sessions])
 Users for a histogram bin as below
Bucket := CALCULATE (
COUNTROWS (
FILTER (
Users,
AND (
[FailRatio] >= MIN ( Buckets[From] ),
[FailRatio] < MAX ( Buckets[To] )
)
)
))
As this was pretty easy I wanted to add the option of the user to define the # of buckets at run time The problem is that the bins from and to columns are calculated columns that need to be refreshed in order to produce new values. So the user need to input the new interval between buckets and then trigger a refresh that will take the new value and use it to calculate the columns in the buckets table.
The buckets table is a linked table with columns that looks like this:
It has 30 rows to allow for a large number of bins. The value of the Interval is used to calculate the bins’ ranges.
A single cell pivot based on the buckets table is used to trigger a refresh just for the buckets table.
The first state show 10% as the interval and 10% as the value from the buckets table (average(interval) )
The user changes the value to 20% which recalculated the Excel buckets table.
After that, user refreshes the tiny pivot that says Refresh here by right clicking and choosing refresh.
At this point the buckets table is refreshed in the model and the users are spread between the new bins.
Voila – bins are now shown in 20% intervals! The last column shows sessions at 100% error. All the remaining columns in Buckets table with the from value above 100% are hidden by the pivot chart because no data is returned for those.
In order to enable the input from Excel web, I have used pivot filter as the input method. For Desktop use you could simply allow user to type in or select a value from dropdown, you could even autorefresh once the input value is changed.
]]>I Interviewed Bill Via Phone – Me in the Arctic of Ohio,
Bill in his Winter HQ Down in Florida
It’s not often that you’re asked to interview one of your friends, but that happened to me last week. The folks at PASS thought it would be interesting if I interviewed Bill Jelen, and then we published that interview on the PASS Business Analytics Conference site.
An excuse for me to call up Bill and jaw for awhile? “Sign me up!” And off we went. I was personally “hooked” by the conversation for a full 40 minutes. Most of Bill’s answers, I had never heard before, and they stimulated some serious “wow” thinking for me.
We found out, afterwards, that the PASS folks were expecting a 10minute interview. Har har. Bill and I later chuckled, in email, at the futility of such expectations. “Let’s get two of the biggest chatterboxes we can find, put them on the phone together, and keep them to 10 minutes.” But the results were good, and PASS decided to publish the whole thing.
They were also gracious enough to share the audio file with us, so I’m posting it here today:
(Fancy Inline Audio Player Should Work on Most Browsers, Or Let You Download the MP3)
I can’t believe I had never heard this before, but Bill first started using spreadsheets as a reporting tool. (Not as an accounting or financial tool).
Even more delicious: he was using spreadsheets as a replacement for an extremely expensive reporting solution that didn’t work!
That was in the 1980’s. How little has changed between now and then! Before the advent of what I call “Modern Excel” (aka Power BI), the world was in EXACTLY the same state 20+ years later. (And in places that have yet to grasp the potential of Power Pivot and its kin, things STILL have not changed. But at least now we have a way out of the decadesold mess).
Anyway, definitely listen to the interview. Lots of interesting nuggets in there, such as the observation that more than half of analytics pros are women.
It’s not too late to join us both, plus other Modern Excel experts, at the PASS Analytics conference next month in Santa Clara.
Next Month’s Speakers Include Quite a Few Proponents of Modern Excel / Power BI
Happy Friday! Our next webinar is coming up in about 10 days from now, on Tue Mar 17th. Make sure you save it to your calendar. See webinar page for more information. Participants would also have an opportunity to signup for our online class at a discounted rate.
For the webinar, we have doubled the capacity from 100, up to 200 attendees – so if you were unable to get in on a previous webinar, take heart! There would be an opportunity to ask questions as well. See Q&A from the past webinar.
Here is what we would cover:
Walkthrough key steps in using Power Pivot and explain how Power Pivot supercharges regular Excel  
Do it Yourself! We would provide you dataset and instructions to try those steps yourself at your own pace and build your first data model. Best way to learn is by doing.  
Q&A: There would be opportunity to ask questions and seek guidance regarding using or deploying Power Pivot or Power BI  
Resources to continue your journey 
See links below for more details:
We’re planning the next event in April covering a new topic. Subscribe to our blog to receive updates on future events.
]]>