Solved

RE-Defining Column cells in Pivot Table

Posted on 2015-02-11
7
64 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
excel filters 2 28
Excel VBA 10 38
If a cell in a range equals "YES" return specific Test. 4 27
Clear Filter 8 30
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…
Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

813 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