I have been trying to find the simplest method for creating a column in my PivotGrid that displays the difference between the only other two columns being displayed in the PivotGrid. I thought this would be a 5 minute exercise that has taken me all afternoon to get to *sort of* work. I am wondering if I am going about this all wrong... let me know before you mentally get into all the details below.
What I ended up with was using a PivotGridAggregateField field, "DifferenceInHoursFromCMS", with a TotalFunction of "DifferenceFrom". The problem I am having with this is that it leaves this empty column in the output (seen in attached screenshot). Is there any way to hide that empty column?
More importantly, all I really want to see is this table structure:
Row 1, Column 1: CMS
Row 1, Column 2: G2
Row 1, Column 3: Difference
So, a sample might look like this:
15 10 5
25 22 3
It doesn't seem like this should be that hard. What is the easiest way to get that output?
Here is my grid:
<telerik:RadPivotGrid ID="pvtCMStoG2" runat="server" DataSourceID="sqlCMStoG2TimesheetValidation" AllowPaging="True" PageSize="15" AggregatesLevel="1">
<PagerStyle ChangePageSizeButtonToolTip="Change Page Size" PageSizeControlType="RadComboBox" AlwaysVisible="True"></PagerStyle>
<Fields>
<telerik:PivotGridColumnField Caption="Source" DataField="Source" UniqueName="Source">
</telerik:PivotGridColumnField>
<telerik:PivotGridRowField Caption="Customer" DataField="CustomerIdentityString" UniqueName="CustomerIdentityString">
</telerik:PivotGridRowField>
<telerik:PivotGridAggregateField Aggregate="Sum" DataField="Hours" GrandTotalAggregateFormatString="" UniqueName="SumOfHours">
<TotalFormat Axis="Rows" Level="0" SortOrder="Ascending" />
<HeaderCellTemplate>
<asp:Label ID="lblHeader" runat="server" Text="Total Hours"></asp:Label>
</HeaderCellTemplate>
</telerik:PivotGridAggregateField>
<telerik:PivotGridAggregateField Aggregate="Count" DataField="Hours" GrandTotalAggregateFormatString="" UniqueName="CountOfVisits">
<TotalFormat Axis="Rows" Level="0" SortOrder="Ascending" />
<HeaderCellTemplate>
<asp:Label ID="lblHeader" runat="server" Text="Service Count"></asp:Label>
</HeaderCellTemplate>
</telerik:PivotGridAggregateField>
<telerik:PivotGridAggregateField Aggregate="Sum" DataField="Hours" GrandTotalAggregateFormatString="" UniqueName="DifferenceInHoursFromCMS">
<HeaderCellTemplate>
<asp:Label ID="lblHeader" runat="server" Text="Difference in Hours"></asp:Label>
</HeaderCellTemplate>
<TotalFormat Axis="Columns" Level="0" SortOrder="Ascending" TotalFunction="DifferenceFrom" GroupName="CMS" />
</telerik:PivotGridAggregateField>
</Fields>
<TotalsSettings RowGrandTotalsPosition="First" ColumnGrandTotalsPosition="None" />
<ConfigurationPanelSettings EnableOlapTreeViewLoadOnDemand="True"></ConfigurationPanelSettings>
</telerik:RadPivotGrid>
What I ended up with was using a PivotGridAggregateField field, "DifferenceInHoursFromCMS", with a TotalFunction of "DifferenceFrom". The problem I am having with this is that it leaves this empty column in the output (seen in attached screenshot). Is there any way to hide that empty column?
More importantly, all I really want to see is this table structure:
Row 1, Column 1: CMS
Row 1, Column 2: G2
Row 1, Column 3: Difference
So, a sample might look like this:
15 10 5
25 22 3
It doesn't seem like this should be that hard. What is the easiest way to get that output?
Here is my grid:
<telerik:RadPivotGrid ID="pvtCMStoG2" runat="server" DataSourceID="sqlCMStoG2TimesheetValidation" AllowPaging="True" PageSize="15" AggregatesLevel="1">
<PagerStyle ChangePageSizeButtonToolTip="Change Page Size" PageSizeControlType="RadComboBox" AlwaysVisible="True"></PagerStyle>
<Fields>
<telerik:PivotGridColumnField Caption="Source" DataField="Source" UniqueName="Source">
</telerik:PivotGridColumnField>
<telerik:PivotGridRowField Caption="Customer" DataField="CustomerIdentityString" UniqueName="CustomerIdentityString">
</telerik:PivotGridRowField>
<telerik:PivotGridAggregateField Aggregate="Sum" DataField="Hours" GrandTotalAggregateFormatString="" UniqueName="SumOfHours">
<TotalFormat Axis="Rows" Level="0" SortOrder="Ascending" />
<HeaderCellTemplate>
<asp:Label ID="lblHeader" runat="server" Text="Total Hours"></asp:Label>
</HeaderCellTemplate>
</telerik:PivotGridAggregateField>
<telerik:PivotGridAggregateField Aggregate="Count" DataField="Hours" GrandTotalAggregateFormatString="" UniqueName="CountOfVisits">
<TotalFormat Axis="Rows" Level="0" SortOrder="Ascending" />
<HeaderCellTemplate>
<asp:Label ID="lblHeader" runat="server" Text="Service Count"></asp:Label>
</HeaderCellTemplate>
</telerik:PivotGridAggregateField>
<telerik:PivotGridAggregateField Aggregate="Sum" DataField="Hours" GrandTotalAggregateFormatString="" UniqueName="DifferenceInHoursFromCMS">
<HeaderCellTemplate>
<asp:Label ID="lblHeader" runat="server" Text="Difference in Hours"></asp:Label>
</HeaderCellTemplate>
<TotalFormat Axis="Columns" Level="0" SortOrder="Ascending" TotalFunction="DifferenceFrom" GroupName="CMS" />
</telerik:PivotGridAggregateField>
</Fields>
<TotalsSettings RowGrandTotalsPosition="First" ColumnGrandTotalsPosition="None" />
<ConfigurationPanelSettings EnableOlapTreeViewLoadOnDemand="True"></ConfigurationPanelSettings>
</telerik:RadPivotGrid>