Pricing changes are coming in January. Contact our Sales team to secure the current price for your desired license.

Calculate Individual Values - via Custom Data Source API

Answered
Mario Rodrigues asked on August 28, 2024

Hi, we're trying to get this feature to work - Calculate Individual Values, but it does not seem to be enabled in our setup - Custom Data Source API.

https://www.flexmonster.com/question/calculate-individual-values/?hilite=%22Calculate%22%2C%22Individual%22%2C%22Values%22 

 

See this screencast for more details 

https://app.screencastify.com/v3/watch/USwaLHx8e5bQVDu9U7Zd

 

6 answers

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster August 29, 2024

Hello, Mario!

Thank you for reaching out to us.

Kindly note that individual property in calculated values is available only for json and csv data sources: https://www.flexmonster.com/api/measure-object/#individual.
Since the calculated measures are calculated on the client side, Flexmonster can only operate with the values that are fetched from the server. The logic of calculating the individual property is that the formula is applied to each row of data before applying aggregation, and with custom data source API, the client side doesn't have this raw data.

If we understand the use case correctly, by enabling the individual property, you want to change the logic of calculating the total column. Could you please let us know if it is something that your end-users can configure on the UI or if applying this logic programmatically would work for your case?
With this information, we'll be able to advise you further.

Regarding your question in the video about the total rows that become empty on expand, it can be configured by the grid.showTotals option. Here is the JSFIddle for reference: https://jsfiddle.net/flexmonster/kgn6waL5/. You can also change the visibility of the totals on the Toolbar Options tab.

Looking forward to hearing from you.

Kind regards,
Solomiia

Public
Mario Rodrigues August 29, 2024

We can apply it programmatically or we can have our end-users can configure - whichever is possible to implement.  See attached.  I'm not sure why the totals work Count of Date of Service: Week, but not Incentive Amount.  We're fetching the values of Date of Service from the server, but since the values are showing on the client side already, why isn't it rolling up like the other columns?  It's showing 10 when it should be summing up.

Any solution to this?

Attachments:
pivot.png

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster August 30, 2024

Hello, Mario!

Thank you for your swift response.

For now, to calculate the total value for the calculated measure, Flexmonster applies a formula to the aggregated total, so in your case, the 10 in the total cell is the value from the if in the formula, like that: if(aggregatedTotalValue > 3, 10, 0).

If it is possible to programmatically configure the measure that is at the moment added as a calculated value to your report, we recommend implementing a custom aggregation on the server side. In a few words, it will be added to your list of aggregations along with sum or count, and all the calculation logic will be moved to the server, where you can add different logic to calculate regular values and total values.

Please check out our docs about the custom aggregations and let us know if the suggested approach would work for your case: https://www.flexmonster.com/doc/support-more-aggregations/#custom-aggs.

Hope you will find our answer helpful.
Feel free to reach out to us if you have any further questions.

Kind regards,
Solomiia

Public
Mario Rodrigues August 30, 2024

Thanks.  I don't think this will work due to all the combinations a user may come up with.  I think we'll try to generate the entire dataset and just load a remote JSON to it.

We can't use the Data Server because all the queries are dynamic.  Only if we could pass in an encrypted SQL query.

I think the only viable option is to generate the entire recordset and load via remote JSON.

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster September 2, 2024

Hello, Mario!

Thank you for your feedback.

Our team agrees that for the described use case, generating a JSON for the report with calculated measures can be a more efficient solution.

Regarding "We can't use the Data Server because all the queries are dynamic," please note that the Data Server is considered an api data source type as well, so it has the same logic of calculating individual values as when implementing custom data source API protocol on your own.

Do not hesitate to reach out to us in case of any other questions.

Kind regards,
Solomiia

Public
Mario Rodrigues September 2, 2024

Thank you Solomiia!

Please login or Register to Submit Answer