Hi all,
I am experienced in Excel, Databases and but just getting to grips with Powerpivot.
Challenge:
I have a table in SQL Server with records pertaining to a period (column 1). This table is populated with the same keys (column 2) for other periods also.
Example:
<table class="MsoNormalTable" style="width:235.0pt;margin-left:4.7pt;border-collapse:collapse;mso-yfti-tbllook: 1184;mso-padding-alt:0cm 5.4pt 0cm 5.4pt" width="313" border="0" cellpadding="0" cellspacing="0"> <tbody><tr style="mso-yfti-irow:0;mso-yfti-firstrow:yes;height:15.0pt"> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> Period
</td> <td style="width:91.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="121" nowrap="nowrap"> Key for period
</td> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> Value1
</td> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> Value2
</td> </tr> <tr style="mso-yfti-irow:1;height:15.0pt"> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> <td style="width:91.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="121" nowrap="nowrap"> </td> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> </tr> <tr style="mso-yfti-irow:2;height:15.0pt"> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> <td style="width:91.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="121" nowrap="nowrap"> </td> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> </tr> <tr style="mso-yfti-irow:3;height:15.0pt"> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> <td style="width:91.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="121" nowrap="nowrap"> </td> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> </tr> <tr style="mso-yfti-irow:4;height:15.0pt"> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> <td style="width:91.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="121" nowrap="nowrap"> </td> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> </tr> <tr style="mso-yfti-irow:5;height:15.0pt"> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> <td style="width:91.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="121" nowrap="nowrap"> </td> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> </tr> <tr style="mso-yfti-irow:6;height:15.0pt"> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> <td style="width:91.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="121" nowrap="nowrap"> </td> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> </tr> <tr style="mso-yfti-irow:7;height:15.0pt"> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> <td style="width:91.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="121" nowrap="nowrap"> </td> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> </tr> <tr style="mso-yfti-irow:8;mso-yfti-lastrow:yes;height:15.0pt"> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> <td style="width:91.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="121" nowrap="nowrap"> </td> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> </td> </tr> </tbody></table>
If it assists, you could think of period 1 as Q1, period 2 as Q2 etc, and I wish to see how two periods vary in terms of their values, both in absolute numerical difference, but also % difference.
Sample un-pivoted results would therefore look something like this:
<table class="MsoNormalTable" style="width:457.35pt;margin-left:4.7pt;border-collapse:collapse;mso-yfti-tbllook: 1184;mso-padding-alt:0cm 5.4pt 0cm 5.4pt" width="610" border="0" cellpadding="0" cellspacing="0"> <tbody><tr style="mso-yfti-irow:0;mso-yfti-firstrow:yes;height:15.0pt"> <td style="width:78.35pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="104" nowrap="nowrap"> Key for period
</td> <td style="width:45.35pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="60" nowrap="nowrap"> Value1
</td> <td style="width:45.35pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="60" nowrap="nowrap"> Value2
</td> <td style="width:62.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="83" nowrap="nowrap"> Value 1Diff
</td> <td style="width:62.8pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="84" nowrap="nowrap"> Value2Diff
</td> <td style="width:81.75pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="109" nowrap="nowrap"> Value1Percent
</td> <td style="width:81.75pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="109" nowrap="nowrap"> Value2Percent
</td> </tr> <tr style="mso-yfti-irow:1;height:15.0pt"> <td style="width:78.35pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="104" nowrap="nowrap"> </td> <td style="width:45.35pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="60" nowrap="nowrap"> </td> <td style="width:45.35pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="60" nowrap="nowrap"> </td> <td style="width:62.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="83" nowrap="nowrap"> </td> <td style="width:62.8pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="84" nowrap="nowrap"> </td> <td style="width:81.75pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="109" nowrap="nowrap"> </td> <td style="width:81.75pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="109" nowrap="nowrap"> </td> </tr> <tr style="mso-yfti-irow:2;height:15.0pt"> <td style="width:78.35pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="104" nowrap="nowrap"> </td> <td style="width:45.35pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="60" nowrap="nowrap"> </td> <td style="width:45.35pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="60" nowrap="nowrap"> </td> <td style="width:62.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="83" nowrap="nowrap"> </td> <td style="width:62.8pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="84" nowrap="nowrap"> </td> <td style="width:81.75pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="109" nowrap="nowrap"> </td> <td style="width:81.75pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="109" nowrap="nowrap"> </td> </tr> <tr style="mso-yfti-irow:3;height:15.0pt"> <td style="width:78.35pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="104" nowrap="nowrap"> </td> <td style="width:45.35pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="60" nowrap="nowrap"> </td> <td style="width:45.35pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="60" nowrap="nowrap"> </td> <td style="width:62.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="83" nowrap="nowrap"> </td> <td style="width:62.8pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="84" nowrap="nowrap"> </td> <td style="width:81.75pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="109" nowrap="nowrap"> </td> <td style="width:81.75pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="109" nowrap="nowrap"> </td> </tr> <tr style="mso-yfti-irow:4;mso-yfti-lastrow:yes;height:15.0pt"> <td style="width:78.35pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="104" nowrap="nowrap"> </td> <td style="width:45.35pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="60" nowrap="nowrap"> </td> <td style="width:45.35pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="60" nowrap="nowrap"> </td> <td style="width:62.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="83" nowrap="nowrap"> </td> <td style="width:62.8pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="84" nowrap="nowrap"> </td> <td style="width:81.75pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="109" nowrap="nowrap"> </td> <td style="width:81.75pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="109" nowrap="nowrap"> </td> </tr> </tbody></table>
I have seen the examples such as budget vs actual here: http://www.powerpivotpro.com/2012/01/salesbudget-integrating-data-of-different-grains/ however, it is not clear to me how to apply this logic to my problem.
It seems that my only option would be to bring each period back as a distinct table, and link them by the [KeyForPeriod] column in Powerpivot and compute the measures.
This seems to have a number of disadvantages below
Note, I have full control over the database, so if it is possible we can generate a more useful schema for input.
Best regards and thanks for your answers in advance.
Topdown.
I am experienced in Excel, Databases and but just getting to grips with Powerpivot.
Challenge:
I have a table in SQL Server with records pertaining to a period (column 1). This table is populated with the same keys (column 2) for other periods also.
Example:
<table class="MsoNormalTable" style="width:235.0pt;margin-left:4.7pt;border-collapse:collapse;mso-yfti-tbllook: 1184;mso-padding-alt:0cm 5.4pt 0cm 5.4pt" width="313" border="0" cellpadding="0" cellspacing="0"> <tbody><tr style="mso-yfti-irow:0;mso-yfti-firstrow:yes;height:15.0pt"> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> Period
</td> <td style="width:91.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="121" nowrap="nowrap"> Key for period
</td> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> Value1
</td> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap"> Value2
</td> </tr> <tr style="mso-yfti-irow:1;height:15.0pt"> <td style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="64" nowrap="nowrap">
1
111
90
12
1
112
80
12
1
113
70
10
1
114
60
10
2
111
80
12
2
112
70
10
2
113
60
10
2
114
50
8
If it assists, you could think of period 1 as Q1, period 2 as Q2 etc, and I wish to see how two periods vary in terms of their values, both in absolute numerical difference, but also % difference.
Sample un-pivoted results would therefore look something like this:
<table class="MsoNormalTable" style="width:457.35pt;margin-left:4.7pt;border-collapse:collapse;mso-yfti-tbllook: 1184;mso-padding-alt:0cm 5.4pt 0cm 5.4pt" width="610" border="0" cellpadding="0" cellspacing="0"> <tbody><tr style="mso-yfti-irow:0;mso-yfti-firstrow:yes;height:15.0pt"> <td style="width:78.35pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="104" nowrap="nowrap"> Key for period
</td> <td style="width:45.35pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="60" nowrap="nowrap"> Value1
</td> <td style="width:45.35pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="60" nowrap="nowrap"> Value2
</td> <td style="width:62.0pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="83" nowrap="nowrap"> Value 1Diff
</td> <td style="width:62.8pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="84" nowrap="nowrap"> Value2Diff
</td> <td style="width:81.75pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="109" nowrap="nowrap"> Value1Percent
</td> <td style="width:81.75pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="109" nowrap="nowrap"> Value2Percent
</td> </tr> <tr style="mso-yfti-irow:1;height:15.0pt"> <td style="width:78.35pt;padding:0cm 5.4pt 0cm 5.4pt; height:15.0pt" valign="bottom" width="104" nowrap="nowrap">
111
90
12
10
0
11%
0%
112
80
12
10
2
13%
17%
113
70
10
10
0
14%
0%
114
60
10
10
2
17%
20%
I have seen the examples such as budget vs actual here: http://www.powerpivotpro.com/2012/01/salesbudget-integrating-data-of-different-grains/ however, it is not clear to me how to apply this logic to my problem.
It seems that my only option would be to bring each period back as a distinct table, and link them by the [KeyForPeriod] column in Powerpivot and compute the measures.
This seems to have a number of disadvantages below
- Since I have tens of “value” column fields it seems very onerous to create a “diff” column and a “percentage diff” column for each value upon import of new data.
- The import of periods (ie 1 through n) will have to be performed by the user (although I expect we could write some VBA to perform this).
- Such a result could be done with a pivot table. What use is powerpivot here?
Note, I have full control over the database, so if it is possible we can generate a more useful schema for input.
Best regards and thanks for your answers in advance.
Topdown.