Dear Telerik,
I'm trying to do an Year-On-Year comparison and I thought that creating a calculateditem will be the way of doing it (similar to this demo). However, I get the error of "Object reference not set to an instance of an object" I wonder what might be the potential cause?
Here's an extraction of the code I have and snapshot to show the grid structure.
Many Thanks.
I'm trying to do an Year-On-Year comparison and I thought that creating a calculateditem will be the way of doing it (similar to this demo). However, I get the error of "Object reference not set to an instance of an object" I wonder what might be the potential cause?
Here's an extraction of the code I have and snapshot to show the grid structure.
<telerik:RadPivotGrid ID="RadPivotGrid_DataView" runat="server" Height="100%" AllowSorting="True" OnItemCommand="RadPivotGrid_DataView_ItemCommand" OnCellCreated="RadPivotGrid_DataView_CellCreated" DataSourceID="Sql_Contract_Details" EnableToolTips="True" EnableZoneContextMenu="True" EnableConfigurationPanel="True" OnFieldCreated="RadPivotGrid_DataView_FieldCreated" Skin="Office2010Blue" OnCellDataBound="RadPivotGrid_DataView_CellDataBound" Culture="en-GB" OnItemNeedCalculation="RadPivotGrid_DataView_ItemNeedCalculation" AllowPaging="True" PageSize="30" AggregatesLevel="1"> <FieldsPopupSettings AggregateFieldsMinCount="1" /> <PagerStyle ChangePageSizeButtonToolTip="Change Page Size" PageSizeControlType="RadComboBox" /> <OlapSettings> <XmlaConnectionSettings></XmlaConnectionSettings> </OlapSettings> <Fields> <telerik:PivotGridReportFilterField Caption="Meeting Class" DataField="MeetingClass" UniqueName="MeetingClass" IsHidden="false"> </telerik:PivotGridReportFilterField> <telerik:PivotGridReportFilterField Caption="Event Type" DataField="EventType" UniqueName="EventType" IsHidden="false"> </telerik:PivotGridReportFilterField> <telerik:PivotGridReportFilterField Caption="M&E Cluster" DataField="M_and_E_Cluster" UniqueName="M_and_E_Cluster" IsHidden="false"> </telerik:PivotGridReportFilterField> <telerik:PivotGridReportFilterField Caption="Source Group" DataField="LeadSource" UniqueName="LeadSource" IsHidden="false"> </telerik:PivotGridReportFilterField> <telerik:PivotGridColumnField Caption="Creation Year" SortOrder="Descending" DataField="CreatedDate" GroupInterval="Year" UniqueName="CreationDateYear" IsHidden="false"> <%--THIS CAUSES "Object reference not set to an instance of an object" ERROR <CalculatedItems> <telerik:PivotGridCalculatedItem GroupName="Forecast for 1999"></telerik:PivotGridCalculatedItem> </CalculatedItems> --%> </telerik:PivotGridColumnField> <telerik:PivotGridRowField Caption="Creation Month" DataField="CreatedDate" GroupInterval="Month" UniqueName="CreationDateMonth" IsHidden="false"> </telerik:PivotGridRowField> <telerik:PivotGridColumnField Caption="Arrival Year" SortOrder="Descending" DataField="EventStartDate" GroupInterval="Year" UniqueName="ArrivalYear" IsHidden="true"> </telerik:PivotGridColumnField> <telerik:PivotGridRowField Caption="Arrival Month" DataField="EventStartDate" GroupInterval="Month" UniqueName="ArrivalMonth" IsHidden="true"> </telerik:PivotGridRowField> <telerik:PivotGridRowField Caption="Status" DataField="StatusText" UniqueName="StatusText" IsHidden="false" SortOrder="None"> <CalculatedItems> <telerik:PivotGridCalculatedItem GroupName="Total Exc TD"></telerik:PivotGridCalculatedItem> <telerik:PivotGridCalculatedItem GroupName="Total"></telerik:PivotGridCalculatedItem> <telerik:PivotGridCalculatedItem GroupName="Conversion % Exc TD"></telerik:PivotGridCalculatedItem> <telerik:PivotGridCalculatedItem GroupName="Conversion %"></telerik:PivotGridCalculatedItem> </CalculatedItems> </telerik:PivotGridRowField> <telerik:PivotGridAggregateField DataField="RecordCount" Aggregate="Count" Caption="Enquiries" IsHidden="false"> </telerik:PivotGridAggregateField> <telerik:PivotGridAggregateField DataField="TotalFunctionRevenue" Aggregate="Sum" Caption="Revenue" IsHidden="false" DataFormatString="{0:C0}"> </telerik:PivotGridAggregateField> <telerik:PivotGridAggregateField DataField="TotalFunctionRevenue" Aggregate="Average" Caption="Average Revenue" IsHidden="false" DataFormatString="{0:C0}"> </telerik:PivotGridAggregateField> <telerik:PivotGridAggregateField DataField="RecordCount" Caption="YOY" IsHidden="false"> <TotalFormat Axis="Columns" TotalFunction="DifferenceFromPrevious" /> </telerik:PivotGridAggregateField> </Fields> <ClientSettings EnableFieldsDragDrop="True"> <Scrolling AllowVerticalScroll="True"></Scrolling> </ClientSettings> <TotalsSettings RowsSubTotalsPosition="None" RowGrandTotalsPosition="None" ColumnsSubTotalsPosition="None" ColumnGrandTotalsPosition="None"></TotalsSettings> <ConfigurationPanelSettings EnableOlapTreeViewLoadOnDemand="True" DefaultDeferedLayoutUpdate="True" LayoutType="OneByFour"></ConfigurationPanelSettings> </telerik:RadPivotGrid>Many Thanks.