Solved

RE-Defining Column cells in Pivot Table

Posted on 2015-02-11
7
63 Views
Last Modified: 2015-02-12
I need to alter the structure of the top PivotTable as created by Excel in the image below to how I've manually copied it to the bottom PivotTable. Changing "evaluationMonth" as defined as a DATE to "Month1", "Month2", etc..

Btw, the data originates from a SQL query, in case it may be easier for me to do something to the data before copying to Excel.

Thanks in advance for any assistance.

Alter-PivotTable-Column.PNG
0
Comment
Question by:Rickzzz
  • 3
  • 3
7 Comments
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40603613
I would change the query before Pivoting.

However, can you show the results of your SQL Query, and let me know what version of SQL you have.
0
 
LVL 32

Expert Comment

by:Rob Henson
ID: 40603622
I assume your dates are mmddyyyy format ie 04/01/2007 is 1st April.

To convert the dates to Month1, Month2 etc one way would be to do this in the source data with a formula and then pulling that new column into the pivot as column headers rather than the date.

However, the dollar amounts in the table have physically moved; $72,028 in original is at intersection of column 06/01/2007 and row 06/01/2007 but column Month1 and row 06/01/2007 in required format.

How are you determining the movement. Could this also be done as formula in the source data?

Thanks
Rob H
0
 

Author Comment

by:Rickzzz
ID: 40603693
@Phillip
In the attached query, effMonth, evalMonth , coverage and inforceAmount are ultimately copied to Excel. "effMonth" is derived from an actual effective date of a policy. Ultimately, I group these policies by their respective effective month and follow their development, by month (evalMonth), to a point in time.

@Rob
The idea is to have the evaluated months of these groups of policies start in the 1st cell as "Month1", rather than the actual date of the month, which is unimportant. So, for instance, the 6/1/2007 group would not have activity until 6/1/2007 and forward. This activity should start in the 1st cell, thus the move of the $72 to the 1st cell. Again, as "Month 1" and so on is better descriptive than the actual month (June 2007).

Hope that makes sense and thanks!
ICS-to-EE-for-Eval.sql
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40603697
No query attached.
0
 

Author Comment

by:Rickzzz
ID: 40603709
It is now and SQL 2012. Thanks.
0
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 500 total points
ID: 40605164
In

SELECT
      effMonth,
      evalMonth,
      coverage,
      SUM(inforcePremium) inforcePremium

Change (or add after)

      evalMonth,

to

         'Month' + convert(nvarchar(10),dense_rank() over(partition by effMonth order by evalMonth)) as evaluationMonth,
0
 

Author Closing Comment

by:Rickzzz
ID: 40605938
Outstanding, thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delete all words in cell more than 5 words 7 47
Sql server Transfering records getting error #NAME? 6 40
Excel partial font macro 14 26
time format showing wrong 12 51
Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

895 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

15 Experts available now in Live!

Get 1:1 Help Now