Posted 5 December 2023, 2:24 am EST - Updated 5 December 2023, 2:29 am EST
pivot table - I want it to not take into account negative values in the table when calculating my grand total value
thank you so much
Forums Home / Wijmo / General Discussion
Posted by: mehmetkaya on 5 December 2023, 2:24 am EST
Posted 5 December 2023, 2:24 am EST - Updated 5 December 2023, 2:29 am EST
pivot table - I want it to not take into account negative values in the table when calculating my grand total value
thank you so much
Posted 5 December 2023, 11:11 pm EST
Hi,
I am currently working on it. I will let you know if the default calculation of the Grand total can be customized as per your use case or not in case of PivotTable.
Thank you for your patience and understanding.
Regards
Posted 6 December 2023, 4:17 pm EST
Hi,
You may handle the formatItem event of the PivotGrid and manually calculate the aggregate using the getAggregate() method. The array passed to this method should be filtered such that it does not contain any negative values. Then you can set the textContent of the required cell as the calculated value.
Please refer to this API link for more information on getAggregate() method:https://developer.mescius.com/wijmo/api/index.html#getaggregate
Please refer to this sample for reference: https://stackblitz.com/edit/js-iy8u3g
Regards
Posted 7 December 2023, 10:27 pm EST
Hİ, thank you so much
Code is not working. can you update code for vue
my structure above
if (response.data.response.length !== 0) { vm.ng.rowFields.push('Tdhp_code', 'Movements_type') vm.ng.valueFields.push('Debit', 'Credit', 'Balance_debit', 'Balance_credit') vm.ng.showRowTotals = 'Subtotals' } onFormatItem (s, e) { if (e.panel === s.cells) { let value = s.getCellData(e.row, e.col, false) if (value !== null) { if (value < 0) { e.cell.style.color = 'darkred' } else { e.cell.style.color = 'black' } } } },
Posted 10 December 2023, 6:40 pm EST
Hi,
Sorry for the delayed response. I have prepared a sample in Vue that you may refer for implementing the same in your application.
Please refer to this sample: https://stackblitz.com/edit/vue-example-1-xkh6dz
Thank you.
Regards
Posted 11 December 2023, 12:21 am EST
thank you so much
Posted 11 December 2023, 2:19 pm EST
Hi,
I am glad that I was able to help you. In case if you have any further queries, please feel free to ask.
Thank you.
Regards