Hello,
We have certain cells that we would like to be excluded from any kind of automatic calculation such as the "totals" columns FlexMonster provides.
We already have the logic for this, essentially a boolean attached to the reportData of the cell that, if true, means the cell should not be included in any kind of calculation.
Is it possible to add such conditions to the totals dimensions?
Best regards,
Jonas
Hello, Jonas,
Thank you for contacting us.
Kindly note that Flexmonster does not provide a feature for excluding specific values from the total calculations. We recommend using one of the following approaches:
Please let us know if it works for you. Looking forward to your response.
Kind regards,
Nadia
Hello Nadia,
As I understand from the approaches you linked, only through the latter is what we want possible - i.e. visible dimensions that are excluded from totals?
Unfortunately, our use-case demands that certain data be both visible but excluded in totals calculations. Implementing a custom data source API seems excessive for what we want to achieve. There is no known workaround to achieve what we want without implementing a custom server?
Best Regards,
Jonas
Hi Jonas,
Thank you for the response.
You can implement a custom total row or column outside the component as a workaround.
For example, you can use the getData
API call to get the Grand Total values. Each object with totals contains either values (v0
- vN
) and columns (c0
- cN
) or values and rows (r0
- rN
). Kindly note that it is necessary to set the slice parameter containing only columns and measures to show the Grand Totals values from the last row.
More information on how to use the getData
method can be found in our documentation: https://www.flexmonster.com/api/getdata/.
Please check the approach illustrated in the following sample: https://jsfiddle.net/flexmonster/dj0b97y1/.
Then, you can subtract the necessary values from the totals and display the desired results in your custom totals.
Please let us know if it works for you. Looking forward to your response.
Kind regards,
Nadia
Hello Nadia,
This may be a necessary workaround. However, it may prove to be slightly complex in some of our cases where we have multiple calculated/totals rows (nested children). I'm worried that implementing custom dimensions in this case can impact other functionality of our application such as formatting and whatnot.
Could we perhaps modify the existing totals dimensions by using customizeCell to alter each cell's .text property to simply display the calculated total? This would obviously only be visual but since these dimensions are not to be interacted with either way, it may be the safest way to go?
Thank you for all your help,
Jonas
Hello Jonas,
Thank you for the response.
You are correct that it is possible to customize the totals using the customizeCell
API call. If it works for you, you can try the mentioned approach.
Feel free to reach out if further questions arise.
Kind regards,
Nadia
Hello Nadia,
Thank you for your help. We will see if we can't figure something out. We would also like to formally request that FlexMonster perhaps look into allowing custom totals logic in the future (that does not require a separate API).
Best regards,
Jonas
Hello Jonas,
Thank you for the response.
We have added the feature of customizing totals in our customers' wishlist. Our team will notify you in case of any updates on the matter. By the way, could you please provide us with a description of how this feature works in similar applications? It would greatly help us.
Looking forward to hearing from you.
Kind regards,
Nadia
Hello Nadia,
Thank you very much for adding it 🙂
The closest comparison I can draw from is Excel, but this kind of works "the other way" around from how FlexMonster does it. Instead of automatically generating totals dimensions, the user has to specify the function (e.g. SUM) and the input (Columns A->C e.g.)
This gives the user free reign to include whatever data they want the column to represent.
Since FlexMonster kind of works the inverse of this, by providing totals dimensions that include all child-members "out of the box", I would imagine that this feature would work the inverse of Excel's. Instead of explicitly adding dimensions to be included in the total, I would expect that I could specify which members to exclude.
As a software developer I would expect the first iteration of this to be in the form of some function API or similar. Maybe a function similar to customizeCells() where, instead of iterating over cells automatically, it iterates over every totals dimension. Here we could then apply our own rules. E.g. something like:
if(totalsColumn.members.includes("[ColumnIWantExcluded]")){
}
if(currentTotalsColumn.member.includes("[columnIWantToExclude]")){
currentTotalsColumn.exclude([columnIWantToExclude])
}
A front-end UI to allow for maximal user-friendliness of this would likely be in the form of a multiple-choice drop-down menu wherein the user would be able to (un)tick whatever dimension they want included in the totals column. This would no doubt take more work and it's not necessarily a must-have for us as we mostly develop our own solutions. But I could see it as a benefit for allowing easier use of the feature.
Thank you for your help,
Br
Jonas
Hello Jonas,
Thank you for providing us with the details.
We will consider your suggestions. Our team will keep you informed if there are any updates regarding this matter.
As always, feel free to reach out in case any questions arise.
Kind regards,
Nadia
Hello Nadia,
I am writing again to inquire about potential developments in the matter, or if you could help us with a workaround.
We managed to create a rudimentary workaround for this issue where every newly generated dimension would have a partner every cell of which was the inverse of the first dimension. E.g.
Custom Dim A: Cell 1 = 500
Custom Dim B: Cell 1 = -500 (hidden from view)
Static Dim: Cell 1 = 1000
Total = 500+-500+1000 = 1000
In summations this effectively excludes the Custom Dim values from the sum.
Unfortunately, in cases other than sum, such as averages, the mere presence of these columns will still impact the total result. E.g.
Custom Dim A: Cell 1 = 500
Custom Dim B: Cell 1 = -500 (hidden from view)
Static Dim: Cell 1 = 1000
Total = (500+-500+1000)/3 = 333.33
When we want either
Total = (500+-500+1000)/1 = 1000
or
Total = 1000/1 = 1000
I had a look at your earlier example again as it may prove relevant for us: https://jsfiddle.net/flexmonster/dj0b97y1/
However, in the example it seems all the totals are still drawing from every column. If it's possible, could you perhaps modify the total column illustrate total average of price and then have that result exclude the "Warehouse" column?
I had a look at the customzieCell() function as well. Unfortunately, without access to the logic that calculates the totals it is extremely difficult to have function.
I apologize for pressing further on this matter, but this feature is very important for the functionality of letting users create custom dimensions.
Hello Jonas,
Thank you for contacting us.
Kindly note that Flexmonster does not provide the functionality to support the exclude cell feature for a JSON data source out of the box. In such a case, the only option for achieving described requirements is implementing the custom data source API. This approach will give you full control over data processing, including totals calculations.
Please note that some Flexmonster features are only supported for the "json"
data source. We recommend checking technical specifications for the "api"
data source: https://www.flexmonster.com/technical-specifications/. However, the custom API approach seems the optimal and flexible solution for your use case.
You are welcome to check our documentation for further details: https://www.flexmonster.com/doc/implement-custom-data-source-api/. You can also check our sample project for reference: https://www.flexmonster.com/doc/pivot-table-with-node-js-server/
You are welcome to reach out in case other questions arise.
Kind regards,
Nadia
Hello Nadia,
Thank you for your help. We will look around for other workarounds. Please keep us updated if any developments on this matter arise 🙂
Best regards,
Jonas
Hello Jonas,
Thank you for the feedback.
You are welcome to contact us in case further questions arise.
Kind regards,
Nadia
Hello FM support team,
Sorry to bother you again, but I have been asked to prompt once again on the matter of defining a custom aggregation (without the need for a custom API). It would be an extremely critical feature for us.
Please keep us in the loop.
Best regards,
Accobat
Hello,
Thank you for reaching out to us.
We understand that you're interested in defining the custom aggregation using the client side of your application. This request was added to our customers' wishlist. However, we can not provide you with a clear ETA as far as this feature is out of our pivot functionality scope.
Please note that the custom data source API is currently the only recommended way to define custom aggregations.
You are welcome to contact us in case other questions arise.
Kind regards,
Nadia