Giving PowerPivot a Keyboard Shortcut

Posted on April 3rd, 2013 in Excel,PowerPivot by Ken Puls

When I was down at Microsoft for the MVP Summit, I suggested that, as the “other most powerful part of Excel” that PowerPivot, like the Visual Basic Editor, should be given it’s own keyboard shortcut.  Since Alt + F12 is currently empty, and since it’s right next to the VBE’s Alt + F11 shortcut, it only seems logical that Alt + F12 would make a logical choice.

Well, I got tired of waiting… not that I ever expected they’d release a patch for that or anything.  So I up a macro to do it.  It’s pretty short, works with Excel 2010 and 2013, and can be stored in the Personal Macro Workbook.*

If you know your macros, or you already have code in your personal workbook, then add the Workbook_Open line and the Sub OpenPowerPivot to your project.  But if you’ve never written a macro, or you’ve never used the personal macro workbook, here’s how you do it:

  • Expose the Developer tab
  • Click on “Record New Macro”
  • Choose to store it in the Personal Macro Workbook.  (That will create your personal macro workbook.)
  • Stop recording
  • Press Alt + F11
  • Find VBAProject(Personal.xlsb) in the Project Explorer.  (The project explorer is the treeview on the left.  If it’s not showing, press CTRL+R to display it.)
  • Double click the ThisWorkbook module inside it
  • Paste the following code in the code pane:

Private Sub Workbook_Open()
Application.OnKey “%{F12}”, “OpenPowerPivot”
End Sub

  • Now open the Modules folder and double click Module 1
  • Replace the code in there with this:

Sub OpenPowerPivot()
On Error Resume Next

Select Case Val(Application.Version)
Case Is = 14
Application.SendKeys “%GY2″
Case Is > 14
Application.SendKeys “%BM”
End Select

On Error GoTo 0
End Sub

  • Close the Visual Basic Editor
  • Close Excel and say Yes when prompted to save changes to the Personal Macro Workbook
  • Re-open Excel and Press Alt+F12

Isn’t that just the height of lazy?  (I mean efficient!)  Smile

*Just a quick note here… if you float back and forth between Excel 2010 and Excel 2013 on the same machine, Excel locks the personal macro workbook for editing when you open the first Excel instance.  So if you open a new copy of Excel, you’ll get a prompt.  Just say okay though, and it will still work fine.

Chandoo’s PowerPivot Course–Registration Closing Soon!

Posted on February 15th, 2013 in Excel,General,PowerPivot by Ken Puls

Just a quick reminder if you’ve been sitting on the fence… Chandoo’s PowerPivot online course registration closes in just over 12 hours (midnight Pacific Time, 2013-02-15).

Don’t get left behind… Click the image below to sign up!

Nasty little F Lock key…

Posted on February 8th, 2013 in Excel,General,I hate it when... by Ken Puls

No really, that is it’s name!

I was trying to figure out why pressing F4 wasn’t toggling from relative to absolute referencing in my Excel formulas, and was starting to think I found a bug in Excel 2013.  But then other stuff started to get weird too…

  • F4, which I use to toggle absolute and relative formulas all the time seemed to do nothing.  But when I was just in a worksheet, and not the formula, it opened a new workbook.
  • F2, which I use to get into formula editing mode, started undoing my last action… which is really scary as I still don’t know if I un-did anything important. I only actually realized this after I typed a formula, clicked on it, pressed F2 and it went away!
  • Alt F11, to get in the visual basic editor did nothing at all.  What the…?

After finding out that it was doing the same thing in a new workbook in Excel 2010, I realized that this was bigger than just Excel.

Apparently I fat-fingered the F Lock key on my (Microsoft Natural) keyboard, which tells the keyboard to start using alternate commands.

Gave me a bit of a heart attack on a Friday afternoon!

PowerPivot Online Course

Posted on February 5th, 2013 in Excel,General,PowerPivot by Ken Puls

I don’t think it’s a secret to anyone who reads this blog that I’m a big fan of PowerPivot.  It’s got some huge capabilities, and I’m convinced that it will be a game changer in the BI landscape.

The challenge though, is that PowerPivot isn’t just a “pick it up, it’s easy” kind of thing.  Take it from an Excel pro, you’re going to need some help to get up to speed with it and really make it sing.  Well good news… Chandoo is releasing the first online PowerPivot course, and registration starts now!

Here’s the details of what Chandoo is going to cover:

What is in this course:
Power Pivot, an Excel add-in makes it easy to connect, analyze & visualize massive amounts of data. This course aims to teach you how to use Power Pivot to analyze data, create advanced reports & prepare dashboards all from the familiar Excel interface. This is ideal for data analysts, reporting & MIS professionals, business analysts, managers & dashboard makers.

Who should sign up for this course?
This course is ideal for data analysts, reporting & MIS professionals, business analysts, managers & dashboard makers.
Please note that you should be familiar with Excel & Pivot Tables and running at least Excel 2010 to enjoy this course.

Important Dates:
- Course registration opens on – 6 Feb 2013
- Registration closes on – 15 Feb 2013
- Classes begin on – 18 Feb 2013
- Classes end on – 31 May 2013
- Online access is valid until – 18 August 2013

The total cost is $247, and you also get a bonus copy of Rob’s DAX eBook (which you’re going to need).

Chandoo is no stranger to online training, having run his online Excel School for some time now.  But what makes this one even better is that, not only does it cover all the awesome content you need to get up to speed, it also includes a couple of guest lectures by some pretty cool people.  One is Rob Collie of www.powerpivotpro.com and the other is… me!  Smile(I’m really looking forward to being a part of this!)

So what are you waiting for?  Click the image below to sign up!

My Workbook Got Stuck in a Cyclone!

Posted on February 4th, 2013 in Excel,I hate it when... by Ken Puls

I thought I actually posted about this some time back, but I don’t see it. It’s driven me nuts before, and is doing it again.

I have to print out our massive financial model for a meeting tomorrow. It’s almost 120 pages, and is laid out in a mix of colour and black and white, landscape and portrait settings.

The first time I ever saw this I was floored, as I thought Excel was turning each page just to drive me nuts. As it happens, it’s a little more predictable (although no less annoying.)

When I print my model, here’s the output of the pages:

Colour pages (landscape):

    

Colour pages (portrait):

    

Okay, so no biggie. I’d rather have the top of the colour landscape pages on the left so I didn’t need to turn them before putting in a left hand binding, but at least it’s consistent. At least, it is until I start mixing in some non-colour worksheets:

Black & white (landscape):

Rotated 180 degrees from the colour worksheet! What the heck is that about? (Yes, Top should be written the other way up, I just wanted this to be easy to read.)

Black & white (portrait):

    

Seriously? 180 degree rotation from colour again?

Run that out for a bit…

So now picture that you’ve got 120 pages, mixed colour and black and white, mixed landscape and portrait. I need to bind at the left, and want the top of the pages to be consistently like the colour landscape and portrait black and white, so the I can bind them on the left side. I’m going dizzy trying to sort this out!

There’s no setting to change this that I can find, so it’s a process of going through each pile of paper, one sheet at a time, to make sure none get missed. What a waste of time!

I’m not sure if this is a printer thing, or an Excel thing. It did it in Excel 2010, and is doing it in 2013.

I’m curious, if you have a colour printer, do you see similar effects?

Updating Page Sizes

Posted on January 30th, 2013 in Excel,I hate it when... by Ken Puls

This drives me crazy. I’m not sure if it was the move to Excel 2013, or if it was something else…

I have this massive model, and we print it out on 11×17 paper. Somewhere, sometime, Excel decided that this is a “Custom page size”, which causes me problems. I need to reset all the pages to 11×17. Easy right? Select all the worksheets, go to Page Layout à Size and choose 11×17.

Not so fast… if you do that, it replicates ALL the print settings including orientation, margins, fit to x pages by x pages, etc.. Nasty stuff. You can actually see why when you record a macro to change the paper size. This is what I get:

  1. Sub Macro1()
  2. '
  3. ' Macro1 Macro
  4. '
  5. '
  6. Application.PrintCommunication = False
  7. With ActiveSheet.PageSetup
  8. .PrintTitleRows = "$1:$8"
  9. .PrintTitleColumns = ""
  10. End With
  11.  
  12. Application.PrintCommunication = True
  13. ActiveSheet.PageSetup.PrintArea = ""
  14. Application.PrintCommunication = False
  15. With ActiveSheet.PageSetup
  16. .LeftHeader = ""
  17. .CenterHeader = ""
  18. .RightHeader = "Printed &D &T"
  19. .LeftFooter = ""
  20. .CenterFooter = ""
  21. .RightFooter = ""
  22. .LeftMargin = Application.InchesToPoints(0.7)
  23. .RightMargin = Application.InchesToPoints(0.7)
  24. .TopMargin = Application.InchesToPoints(0.75)
  25. .BottomMargin = Application.InchesToPoints(0.75)
  26. .HeaderMargin = Application.InchesToPoints(0.3)
  27. .FooterMargin = Application.InchesToPoints(0.3)
  28. .PrintHeadings = False
  29. .PrintGridlines = False
  30. .PrintComments = xlPrintNoComments
  31. .PrintQuality = 600
  32. .CenterHorizontally = False
  33. .CenterVertically = False
  34. .Orientation = xlLandscape
  35. .Draft = False
  36. .PaperSize = xlPaper11x17
  37. .FirstPageNumber = xlAutomatic
  38. .Order = xlDownThenOver
  39. .BlackAndWhite = False
  40. .Zoom = False
  41. .FitToPagesWide = 1
  42. .FitToPagesTall = False
  43. .PrintErrors = xlPrintErrorsDisplayed
  44. .OddAndEvenPagesHeaderFooter = False
  45. .DifferentFirstPageHeaderFooter = False
  46. .ScaleWithDocHeaderFooter = True
  47. .AlignMarginsHeaderFooter = True
  48. .EvenPage.LeftHeader.Text = ""
  49. .EvenPage.CenterHeader.Text = ""
  50. .EvenPage.RightHeader.Text = ""
  51. .EvenPage.LeftFooter.Text = ""
  52. .EvenPage.CenterFooter.Text = ""
  53. .EvenPage.RightFooter.Text = ""
  54. .FirstPage.LeftHeader.Text = ""
  55. .FirstPage.CenterHeader.Text = ""
  56. .FirstPage.RightHeader.Text = ""
  57. .FirstPage.LeftFooter.Text = ""
  58. .FirstPage.CenterFooter.Text = ""
  59. .FirstPage.RightFooter.Text = ""
  60. End With
  61.  
  62. Application.PrintCommunication = True
  63.  
  64. End Sub

This is what I need:

  1. Sub Macro1()
  2. With ActiveSheet.PageSetup
  3. .PaperSize = xlPaper11x17
  4. End With
  5. End Sub

Actually, even more pointed, this will fix it without messing all my other settings up:

  1. Sub Macro1()
  2. Dim ws As Worksheet
  3.  
  4. For Each ws In ActiveWorkbook.Worksheets
  5. ws.PageSetup.PaperSize = xlPaper11x17
  6. Next ws
  7.  
  8. End Sub

I know why the code records as it does, as Excel doesn’t know what settings I truly need, so it records the current state of all PageSetup stuff. But I sure wish when I tried to update one print setting via the user interface that it gave me the ONE I changed, not everything.

PowerPivot And DAX Just Got A Whole Lot Easier…

Posted on November 23rd, 2012 in Excel,General,PowerPivot,Software Reviews by Ken Puls

As many readers of this blog will know, I am a huge fan of PowerPivot, and honestly believe that this is THE most important feature to hit Excel since VBA was introduced to the product. And anyone who has ever taken a course from me knows that VBA is the greatest thing to be added to Excel since the grid was mapped into rows and columns.

For those who don’t know, PowerPivot was a free add-in to Microsoft Excel 2010, and is now baked into the Excel 2013 release. It basically allows us to pull data from different sources (multiple databases, text files, web data feeds, excel worksheets and more) into a separate layer of our file, and create relationships between the resulting tables. Basically you can aggregate data from a bunch of different sources and EASILY aggregate it into your very own business intelligence engine.

The amazingly cool part is that it’s not hard to do this. With a little knowledge about relational data (and I mean a little), and knowledge of text functions like these, you can build the columns necessary to relate your data. From there you create the table relationship (PowerPivot even tells you if you try to build it backwards), and you’re off to the races.

The results of this are, quite frankly, groundbreaking. You can then build PivotTables off this data: PivotTables that are sourced from multiple tables at once. No more massive VLOOKUP tables to build one huge data table with everything. It’s simply no longer necessary. And with the variety of sources, you can even pull in and start adding items to your pivots that you never thought of before, like the weather for example. Does your corporate database have that? I doubt it, but who cares? Just source a weather feed from the internet, relate the dates to the dates in your sales table and presto! You can now see how sales were on the sunny days in a month vs the cloudy ones.

It’s amazingly easy to get some cool stuff out of PowerPivot… at least… to a point. To over-simplify things, I’d say that PowerPivot allows you to do four overall things:

  1. You can source and relate tables to build your own aggregated data source (a mini BI database if you like.)
  2. You can build PivotTables pulling in fields from multiple tables.
  3. You can build OLAP formulas, allowing you to pull data for a specific element right into the worksheet, without building a whole PivotTable to do it.
  4. You can build super duper wickedly complex and powerful calculated fields for your PivotTables using DAX.

To me, the first three were easy. As an Excel pro with a bit of relational database knowledge, I’ve been able to work through the first 3 over the past couple of years with very little in the way of roadblocks. And by doing so, I’ve built some amazingly cool things for our company. Yet despite this, I’ve always been aware that the real piece de resistance, the part that really makes things sing in PowerPivot is DAX.

What the heck is DAX? It stands for Data Analysis eXpressions, and is the formula language that you use to create what PivotTable users know as “Calculated Fields”. It is unbelievably powerful but, without tutelage, it is unbelievably hard. For almost two years I’ve been struggling to understand DAX.

That ended this past week.

Last week I bought a bought Rob Collie’s new book “DAX Formulas for PowerPivot: The Excel Pro’s Guide to Mastering DAX”. When you are ready to take the DAX journey, you MUST have this book.
Rob’s writing style is identical to that you’ll find on his blog at http://www.powerpivotpro.com/. In fact, the only difference is that he doesn’t fill up any real estate with movie quotes. :) What you do get is a huge amount of insightful information.

I can honestly say that, despite being a fairly accomplished Excel pro, I have been unable to wrap my arms around DAX. But that is over. Four days of working through this book with my own data and I am now making some damn cool stuff that eluded me before.

What I love about this book is that Rob sat down and carefully thought through how an Excel pro should learn DAX, then started at the beginning. It progresses logically, is very easy to read, and actually gets you there. Yes, you need to practice, but weren’t you going to do that anyway? And when you practice…

There’s something really important between these pages that I doubt you’ll ever see in the advertising. With any programming language (yes, Excel formulas fit that bill, as do DAX formulas) there are two critical things to learn. The first is Syntax (how you do something), and the second is how to debug something. Rob gives you both, which is critical on the path to mastery. He has some nice little charts that explain how filters are applied to the CALCULATE function, (which is like SUMIF on steroids.) With those charts, you can actually follow the steps to figure out exactly why your measure is not doing what you want. (Trust me, it was doing this that actually helped me finally get that Eureka moment that I’ve been looking for!)

Four days. I’ve gone from not being able to make anything but the most simple DAX measure to the point where I can create some pretty cool CALCULATE functions (my new best friend), with nested date/time intelligent functions as well. I’ve been pursuing that for TWO YEARS!

In an hour this morning, I was able to build a nice little “Server Contest” dashboard for our food and beverage department. It has slicers to drive down into sales areas, major groups (entrees vs desserts), and dates. And it will correctly report the week-to-date, month-to-date and prior weekly sales in units, as at the selected point in time. (Previously, I was able to get the “effective date” to work, and my “current month” to work, but I could never figure out how to filter things to give me the correct month to date number if I clicked an earlier date. It always kept returning the real month to date, rather than the effective month to date.)

The dashboard is a beautiful thing (to us anyway), that we’ve never been able to produce until today:

11-22-2012 10-38-01 PM

After struggling with DAX for so long, I think it’s fair to say that I wouldn’t have been able to break through this without Rob’s help. I certainly wouldn’t have been able to build the report above in such a short time.

If you’re struggling with DAX, or just getting ready to start the journey get his book. You owe it to yourself.

You can pick it up from Amazon.ca (for all my Canadian colleagues) by clicking here. If you’d prefer to deal with Amazon.com, you can get it by clicking here. And/or from other routes as detailed on Rob’s Website.

PowerPivot – It sure would be nice if…

Posted on May 9th, 2012 in Excel,General,I hate it when...,PowerPivot by Ken Puls

I’ve been doing a lot of work with PowerPivot where I connect to databases. My normal development cycle is as follows:

  • Connect to a view or table, pulling in ALL columns
  • Work through my data scenario until I’ve worked out my logic and solve the issue I’m trying to solve
  • Cut the table/view query down to just the required columns
  • Add WHERE clauses to cut the data down to just the bare minimum I need
  • Deploy to my users

By doing all this, I really focus on trying to optimize the file size and refresh time as much as possible.

As I do this, I cut the number of columns out, then flip from the GUI table view to SQL to add my WHERE clause(s). One thing that I find that really sucks though, is that when I do flip the “Table Properties” to SQL view, it comes out like this:

  1. SELECT [dbo].[vw_opt_MemberProfiles].[AccountType],[dbo].[vw_opt_MemberProfiles].[CustomerType],[dbo].[vw_opt_MemberProfiles].[SortCode_Account],[dbo].[vw_opt_MemberProfiles].[SortCode_LastName],[dbo].[vw_opt_MemberProfiles].[ClubMemberCode],[dbo].[vw_opt_MemberProfiles].[Full_Name],[dbo].[vw_opt_MemberProfiles].[LastName],[dbo].[vw_opt_MemberProfiles].[FirstName],[dbo].[vw_opt_MemberProfiles].[MemberCardNumber],[dbo].[vw_opt_MemberProfiles].[GranCert_Previous],[dbo].[vw_opt_MemberProfiles].[Gran_Sold_Date],[dbo].[vw_opt_MemberProfiles].[Gran_Sold_To] FROM [dbo].[vw_opt_MemberProfiles] WHERE [dbo].[vw_opt_MemberProfiles].[SortCode_Account] <> '#'

I would LOVE to see it come out more like this by default:

  1. SELECT
  2. [dbo].[vw_opt_MemberProfiles].[AccountType],
  3. [dbo].[vw_opt_MemberProfiles].[CustomerType],
  4. [dbo].[vw_opt_MemberProfiles].[SortCode_Account],
  5. [dbo].[vw_opt_MemberProfiles].[SortCode_LastName],
  6. [dbo].[vw_opt_MemberProfiles].[ClubMemberCode],
  7. [dbo].[vw_opt_MemberProfiles].[Full_Name],
  8. [dbo].[vw_opt_MemberProfiles].[LastName],
  9. [dbo].[vw_opt_MemberProfiles].[FirstName],
  10. [dbo].[vw_opt_MemberProfiles].[MemberCardNumber],
  11. [dbo].[vw_opt_MemberProfiles].[GranCert_Previous],
  12. [dbo].[vw_opt_MemberProfiles].[Gran_Sold_Date],
  13. [dbo].[vw_opt_MemberProfiles].[Gran_Sold_To]
  14.  
  15. FROM [dbo].[vw_opt_MemberProfiles]
  16.  
  17. WHERE [dbo].[vw_opt_MemberProfiles].[SortCode_Account] <> '#'

It would sure make it a LOT easier to read, and a LOT easier to work with.As it is, I now copy my code out of PowerPivot, then head over to Instant SQL Formatter.  Copy, paste, format, copy and paste it back into PowerPivot.  A heck of a lot easier to read, but also an unnecessary pain in the behind.

Online VBA Registration – Closing Soon…

Posted on September 15th, 2011 in Excel,General by Ken Puls

Hi Folks,

I’ve been busy and not able to blog much lately, but I just go an email from Chandoo that I thought I’d share.

Chandoo is taking another round of students for his VBA classes. I’ve heard very good things about it. Here’s what Chandoo has to say:

So far, we have enrolled 180 students in to this batch. We are eager to enroll as many more as possible during next one day.

We will be closing enrollments for this on September 16 by 12 Midnight Pacific Time. Please tell your subscribers & readers about this so that they can join in time.

The course comes in 4 flavors:

  • VBA Classes with Online Access – $97
  • VBA Classes with Downloadable Access – $147
  • Excel School + VBA Classes – $247
  • Excel School + Dashboards + VBA Classes – $347

You can sign up for one of this classes by clicking this link.

(FYI, I’m hoping to be back blogging and posting again soon… things have been – well actually… continue to be – crazy! But I should be able to carve some time out of my schedule again shortly.)

Quick Tip – Flip Numbers From + To – (Or Vice Versa)

Posted on July 29th, 2011 in Excel,General,Office 2007,Office 2010 by Ken Puls

I was working with some budget stuff today and wanted to forecast that a range of accounts would be written off. I had a forecast that showed the projected transactions monthly, (all zeros as the projects have been discontinued,) and the projected year-end balance. So I basically wanted to take the projected year-end balances, flip them from positive to negative and stuff them in the July transaction column. Here’s how:

  • Copy the range of numbers
  • Right click the destination and choose PasteSpecial
  • Select Values and Subtract:

  • Say OK and voila:

Now interestingly enough, if there are values in the cells, it overwrites them. If there are formulas in the cells, it subtracts them from the formulas. Kind of odd that it isn’t consistent.

(And of course, if you subtract a negative number, it turns into a positive too.)

Next Page »