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:

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.


Next you must provide your Microsoft Exchange credentials.


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


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


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.


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.


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). 


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.


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.


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:

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

Virtually –

In Person Workshop –


  1. Hat dies auf MS Excel | Power Pivot | DAX rebloggt und kommentierte:
    im neuen Dezemberupdate von Power Query Preview kann nun auch Exchange als Datenquelle verwendet werden. Ich habe das soeben mit meinem Office 365 Konto getestet, das funktioniert tadellos. Damit tuen sich interesannte Auswertungsmöglichkeiten auf…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s