Solved

Group by Issues with date field when using power query

Posted on 2016-09-10
5
35 Views
Last Modified: 2016-09-13
Hello,

I am having trouble grouping by date when using power query to import data from an excel file.  The group by option is grayed out.  If I open the excel file and create a pivot table with the data directly the group by date option is available which leads me to believe that the problem is not with the data in the date field.

I will have updated data regularly and want to use power query to create a link so that I can create a pivot table one time rather than having to create a new pivot table each time I export data.

Any help would be greatly appreciated.

thanks
0
Comment
Question by:Karen Emch
5 Comments
 
LVL 7

Expert Comment

by:tomfarrar
Comment Utility
What do you mean you are having trouble with the grouping in the power query/pivot?  Can you provide an example file?
0
 
LVL 28

Accepted Solution

by:
Subodh Tiwari (Neeraj) earned 250 total points
Comment Utility
That means you are loading the table to the PowerPivot Data model. Right?
The Pivot Table created based on PowerPivot Data Model doesn't support the Grouping features for Dates.
To handle this situation, you will need to create a separate Excel file with Calendar Table having a column named Date for all the sequential dates and create helper columns for Month Number, Month Name, Year, Quarter etc. and add this table to the PowerPivot data model too and create a relationship between date field of your power query table and your calendar table in PowerPivot Diagram View window.
Once done, you may insert a Pivot Table and drag the required date fields from the calendar table into the Row area not from your power query table date field. This way you explicitly create grouping through the calendar table.
0
 
LVL 16

Assisted Solution

by:Jerry Paladino
Jerry Paladino earned 250 total points
Comment Utility
Karen,

When you create the Query (New Query; From File; From Workbook), choose EDIT instead of LOAD so you can ensure your date column is being interpreted as dates.   It is actually a good practice to specifically set the "Type" of all the columns in your query.

In the Query Editor, right click on the date column and select Change Type and Using Locale...   This tells Power Query the regional format to use for the dates.   Once this is done, you can use the column filter to see if there are any errors in the column that may be preventing the Group By to function properly.

Power Query does not load to the "Date Model" unless you specifically choose that option on load.  If you are choosing to load to the Data Model then follow Neeraj's post above.  If not, the result of the query will either be an Excel Table or a connection to the source data.  Either can be used to build your pivot table and should allow for Date grouping.  

Thanks,
JerryChoose EditChange TypeSet Locale...
0
 

Author Comment

by:Karen Emch
Comment Utility
Thanks for everyone's input.   I was loading to the data model as I'd like to add some formulas using DAX.  I am new using power pivot and power query and had completely forgotten about having to add the calendar.   For now I'll use power query to load to a table until I can refresh my memory on how to properly add the calendar.   I'll just have to add the calculated column outside the pivot table for now.  It should be an okay work around.

Thanks again for everyone's help.

Karen
0
 
LVL 28

Expert Comment

by:Subodh Tiwari (Neeraj)
Comment Utility
You're welcome Karen! Glad we could help.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now