Solved

Group by Issues with date field when using power query

Posted on 2016-09-10
5
65 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 7

Expert Comment

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

Accepted Solution

by:
Subodh Tiwari (Neeraj) earned 250 total points
ID: 41792999
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
ID: 41793282
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
ID: 41796367
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 31

Expert Comment

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

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

688 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