Sorting Dates in PivotTable

dinsyp

New Member
Joined
Aug 26, 2014
Messages
14
Hi People,

I have a set of data from which I am creating a Pivot Chart. The data has a series of learning modules and their completion dates.

I have created a column in the data which creates a month and year value (date format mm-yyyy) so I can display by month. The formula to create the field is =MONTH([@[Course Completion Date]])&"-"&YEAR([@[Course Completion Date]]).

When I create the pivot table from this data and set the counter of users completing the learning as a running total based on the month-year field, I want the month-year field in the Pivot Table to sort by year e.g. 10-2020, 12-2020, 10-2018, 12-2019.

Unfortunately, this doesn't seem to work unless I manually set the date column. If I filter the learning module values to display only one module, the sort gets lost. .

I need the data to always display sorted by year and month, e.g. 10-2018, 11-2018, 12-2018, 1-2019, 2-2019 irrespective of how the learning module is filtered.

Any thoughts and ideas gratefully received.
 

Attachments

  • Capture.PNG
    Capture.PNG
    15.1 KB · Views: 7

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

mart37

Well-known Member
Joined
Aug 4, 2017
Messages
1,091
Office Version
  1. 2016
Platform
  1. Windows
maybe you switch year and month: yyyy-mm
 

dinsyp

New Member
Joined
Aug 26, 2014
Messages
14
Thanks for that. An improvement, but still not fully functional. Ive noticed that the powerpivot table has that field as text rather than date. But the table that is behaving is like that anyhow so probably not the cause.
 

mart37

Well-known Member
Joined
Aug 4, 2017
Messages
1,091
Office Version
  1. 2016
Platform
  1. Windows
With =MONTH([@[Course Completion Date]])&"-"&YEAR([@[Course Completion Date]]) you have created a text column.
 

dinsyp

New Member
Joined
Aug 26, 2014
Messages
14
Thanks. I thought that would have been a date column. But I don't think that's the issue as the working pivotchart has the same text based field.

Further investigation makes me wonder whether there is an issue with the running total. Whenever I filter down to a specific module where the running total is the same for consecutive months, the chart doesn't report more than one, and then the month order is out of whack.

I've found that its only the monthyear label that's out of whack. After a couple of changes to the filter, it appears the row label is not keeping sync with the data within the pivottable. Moving a row label to the correct position in the table updates the data. In the out order data image, you can see the top monthyear vaue is 7-2017 with values in the related columns for 2 modules. In fact the first monthyear value should 9-2016 which can be seen in the Incorrect Row image way down the list of dates with running count duplicating the adjacent row. Once 9-2016 is in the correct position in the table (first row), the correct running total value for that date appears as seen in the In Order data image.

My resolution at this stage will be to not show the date range on the chart.
 

Attachments

  • Out of order data.PNG
    Out of order data.PNG
    3.7 KB · Views: 10
  • Incorrect row.PNG
    Incorrect row.PNG
    2.1 KB · Views: 10
  • In order data.PNG
    In order data.PNG
    4.3 KB · Views: 10

dinsyp

New Member
Joined
Aug 26, 2014
Messages
14
I've recolved it! Recreated the MonthYear field as YearMonth using the Text function. Works well so far. Thanks for being my bouncing board:)
 
Solution

Watch MrExcel Video

Forum statistics

Threads
1,130,053
Messages
5,639,792
Members
417,114
Latest member
JPFaulkner

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top