Blog Post

Using Power Query to Parse your Inbox

,

One of the nice new features that was added to Power Query with the latest update in December is the ability to connect to Microsoft Exchange as a data source.  You can download this update now here:

http://www.microsoft.com/en-ca/download/details.aspx?id=39933

Here’s a quick demonstration of how you may use the Microsoft Exchange data source in a Power BI solution:

After downloading and installing Power Query launch Excel and navigate to the Power Query tab.  If you don’t see the Power Query tab you may need to turn on the feature, which I describe here. From the Power Query Tab select From Other Sources and pick From Microsoft Exchange.

SNAGHTML44640f7

Next you must provide your Microsoft Exchange credentials.

image

It will then prompt you to authorize Power Query to access your account.

image

Once the authentication completes the Navigator pane will launch with a view of your Exchange account.

image

In the Navigator pane you can select you mailbox, calendar, contacts, or tasks.  You could hover over each of these options to get a preview of what the data looks like.  For this demonstration select Mail then pick Edit Query.  This will launch the Query Editor with an entry for each email in your Inbox.  Of course if you have thousands of emails this will show just a sampling of the email you have.

image

I’ve hidden the results in this screen shot to protect the innocent but it does indeed return back my mailbox results.  Here’s the kind of metadata it returns.

  • Inbox Path
  • Subject
  • Sender
  • To
  • CC
  • Time Sent
  • Time Received
  • Importance
  • Is Read?
  • Has Attachments?
  • Preview of the Body
  • The Full Email Body
  • Etc…

What I’d like to do is see who sends me the most emails. So I expand the sender column to return back the Name of the sender for each of these emails.  I only care about the Name column so I’ll filter out the address.

image

For this example I only care about counting the number of emails I get by sender so I’ll remove all the irrelevant columns and only keep the Sender.Name.  To remove all other columns select the one you want to keep then right-click on one of the columns and select Remove Other Columns (My screenshot show this on a different column). 

image

This will leave you with only one column but we need at least one other column to aggregate the number of Emails.  This can be done by creating an Index column.  Right-Click on the only remaining column and select Insert Index Column.  This will be used for returning a count of emails.  This could have also likely been done by doing a count of the ID column that was in the original dataset.  Click Apply & Close to take the results of this Power Query solution and build a report on it.  This may take a while depending on how many emails you have. 

I’ve decided to create a Power View Report to visualize who emails me most.  With the Power Query table selected in Excel go to the Insert menu and select Power View.  Once Power View launches it will automatically place the Sender and Index column into a table.  Change the Index column to Count (Not Blank).  This will produce an output that shows each sender and the number of emails from each.

image

Now, change this visualization to a Stacked Bar chart to easily visualize each sender and the number of emails they send.  After sorting the chart descending I see the final result shows that the Brian Knight, my brother and owner of the company, is the person that fills up my inbox the most.

image

Now this is a neat demonstration, but how can you make it work for a business solution?  Personally, I know severally organizations that could use this for parsing support inboxes to organize and see which users have taken up the most time (inbox time at least) from support.  So yes there is a business application and a pretty neat one at that!

Go download the latest Power Query update here:

http://www.microsoft.com/en-ca/download/details.aspx?id=39933

Are you interested in learning more about Power BI?  Attend one of the classes I offer either in person or virtually

Virtually –http://pragmaticworks.com/LearningCenter/VirtualTraining/BusinessAnalytics.aspx

In Person Workshop –http://pragmaticworks.com/LearningCenter/Workshops/BusinessAnalytics.aspx

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating