This is a migrated thread and some comments may be shown as answers.

Hide a total column

3 Answers 330 Views
PivotGrid and PivotFieldList
This is a migrated thread and some comments may be shown as answers.
paulo g
Top achievements
Rank 1
Veteran
paulo g asked on 27 Jul 2020, 12:54 PM
Hi,
Is there a way to hide a total column? (I want to hide the middle total column in image Untitled.png)
Also I want to create a calculated column due "MAS Fund", "Manager Product" and "Date" values (Untitled2.png) Is it posible?

Regards
Paulo

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 28 Jul 2020, 09:01 AM

Hello, Paulo,

According to the provided screenshot, it seems that the AggregatesPosition property is specified to PivotAxis.Columns. That is why the added aggregates are shown for each column description:

        private void RadForm1_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'nwindDataSet.Orders' table. You can move, or remove it, as needed.
            this.ordersTableAdapter.Fill(this.nwindDataSet.Orders);

            this.radPivotGrid1.RowGroupDescriptions.Add(new DateTimeGroupDescription() { 
                PropertyName = "OrderDate", Step = DateTimeStep.Year, GroupComparer = new GroupNameComparer(), AutoShowSubTotals=true });
            this.radPivotGrid1.RowGroupDescriptions.Add(new DateTimeGroupDescription() { 
                PropertyName = "OrderDate", Step = DateTimeStep.Quarter, GroupComparer = new GroupNameComparer(), AutoShowSubTotals=true  });
            this.radPivotGrid1.RowGroupDescriptions.Add(new DateTimeGroupDescription() { 
                PropertyName = "OrderDate", Step = DateTimeStep.Month, GroupComparer = new GroupNameComparer() });

            this.radPivotGrid1.ColumnGroupDescriptions.Add(new PropertyGroupDescription() {
                PropertyName = "EmployeeID", GroupComparer = new GrandTotalComparer(), AutoShowSubTotals=true });

            this.radPivotGrid1.AggregateDescriptions.Add(new PropertyAggregateDescription() {
                PropertyName = "Freight", AggregateFunction = AggregateFunctions.Sum });
            this.radPivotGrid1.AggregateDescriptions.Add(new PropertyAggregateDescription() { 
                PropertyName = "Freight", AggregateFunction = AggregateFunctions.Average });

            this.radPivotGrid1.FilterDescriptions.Add(new PropertyFilterDescription() { 
                PropertyName = "ShipCountry", CustomName = "Country" });
            
            this.radPivotGrid1.DataSource = this.ordersBindingSource ;

            this.radPivotGrid1.RowGrandTotalsPosition = TotalsPos.Last;
            this.radPivotGrid1.RowsSubTotalsPosition = TotalsPos.Last;
            this.radPivotGrid1.AggregatesPosition = PivotAxis.Columns;
        }

There is a property AutoShowSubTotals for the PropertyGroupDescription specifying whether the sub total for the respective property will be shown or not.

You could hide the grand or sub totals position the following way: 

this.radPivotGrid1.ColumnGrandTotalsPosition = Telerik.WinControls.UI.TotalsPos.None;
this.radPivotGrid1.RowGrandTotalsPosition = Telerik.WinControls.UI.TotalsPos.None;
this.radPivotGrid1.ColumnsSubTotalsPosition = Telerik.WinControls.UI.TotalsPos.None;
this.radPivotGrid1.RowsSubTotalsPosition = Telerik.WinControls.UI.TotalsPos.None;

Please check the following documentation article providing additional information on how the pivot layout can be tuned: https://docs.telerik.com/devtools/winforms/controls/pivotgrid/layout-settings 

In case you are still experiencing any further difficulties, it would be greatly appreciated if you can provide a sample project demonstrating the undesired behavior that you are facing. Thus, we would be able to get better understanding of the precise case and think about a suitable solution.

As to the question about calculated fields in RadPivotGrid, please have a look at the following help article which is quite useful on this topic: https://docs.telerik.com/devtools/winforms/controls/pivotgrid/calculated-fields 

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

0
paulo g
Top achievements
Rank 1
Veteran
answered on 28 Jul 2020, 02:30 PM

Hi

1) Total: this.radPivotGrid1.ColumnGrandTotalsPosition = Telerik.WinControls.UI.TotalsPos.None;

This hides all Totals. Is It posible to hide a specific Total?

2) Calculated fields: https://docs.telerik.com/devtools/winforms/controls/pivotgrid/calculated-fields 

I checked this. The example is with one RequiredField and it has to be numeric. I need 3 required fields, and they could be string to compare some conditions. Is that posible?

3) One more consult --> Iterating Cells: https://docs.telerik.com/devtools/winforms/controls/pivotgrid/iterating-cells

Can be the cell value replaced? It seems that the property is just {get;}. Is there a way to achieve the cell value replacement?

 

Best Regards,

Paulo

 

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 30 Jul 2020, 08:57 AM

Hello, Paulo,

Straight to your questions:

1. Indeed, the ColumnGrandTotalsPosition property allows to to hide or show all of the grand totals. But it sounds reasonable to provide an API that allows you to control which grand totals to be shown.

I have logged it in our feedback portal by creating a public thread on your behalf. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

2. Indeed, the calculated fields are usually used with achieving custom calculations. Since RadPivotGrid is intended to aggregate mostly numeric data and display the evaluated results, it may not be appropriate for comparing string values. I am not familiar with the complete goal that you are trying to achieve. Could you please give us some more details about the precise case? Once we get better understanding of the precise case, we would be able to think about a suitable solution and provide further assistance.

3. We already have a feature request for editing options in RadPivotGrid. You can track its progress, subscribe for status changes and add your comments on the following link: https://feedback.telerik.com/winforms/1371023-add-radpivotgrid-end-user-capabilities-for-editing-the-data

In case you need to provide data editing to your end-users, I would suggest you to consider using RadGridView. It also allows to display total sums of certain fields either via a calculated column or via summary row:
https://docs.telerik.com/devtools/winforms/controls/gridview/columns/calculated-columns-(column-expressions
https://docs.telerik.com/devtools/winforms/controls/gridview/rows/summary-rows
https://docs.telerik.com/devtools/winforms/controls/gridview/end-user-capabilities/editing-behavior

Should you have further questions please let me know.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Tags
PivotGrid and PivotFieldList
Asked by
paulo g
Top achievements
Rank 1
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
paulo g
Top achievements
Rank 1
Veteran
Share this question
or