Solved

Group by Issues with date field when using power query

Posted on 2016-09-10
5
54 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 30

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 30

Expert Comment

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

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

730 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