Solved

RE-Defining Column cells in Pivot Table

Posted on 2015-02-11
7
62 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 31

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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

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…
Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

708 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

13 Experts available now in Live!

Get 1:1 Help Now