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

Calculated Measures are not totalizing

Answered
Jean Teran asked on December 6, 2024

I'm trying to replicate a calculation in the frontend side using the raw data of FM Dataserver, if you see the image you can notice that it has four columns, the 1st and 2nd columns are the calculated values that are coming from backend side, the 3rd and 4th were my custom intents to recreate it, the formula is apparently working because it is getting the correct values, the only issue that I have is that in my custom measures the data is not totalizing like the backend examples.

Here an example of my formula:

      const measure = {

          formula: `if(min('invoiceDate') >= ${monthRangeDates[0]} and max('invoiceDate') < ${monthRangeDates[1]} , sum('salesAmount'), 0`,

          uniqueName: 'testingMeasure',

          caption: 'YTD Custom',

          active: true,

          aggregation: 'sum',

      };

3 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster December 6, 2024

Hello Jean,

Thank you for contacting us.

Our team would like to explain that the totals of the calculated measure are calculated using the formula as well. It means that the totals are based on the if(min('invoiceDate') >= ${monthRangeDates[0]} and max('invoiceDate') < ${monthRangeDates[1]} , sum('salesAmount'), 0 formula and not the sum of the values. Therefore, we recommend sticking to the calculated values that are coming from your server.

Please let us know if it works for you. Looking forward to hearing from you.

Kind regards,
Nadia

Public
Jean Teran December 6, 2024

Nadia, thanks for your answer, It saddens us to know that because it was a way to simplify some business logic in our end, so if exists another solution, please let me know.

Thanks.

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster December 9, 2024

Hello Jean,

Thank you for the response!

Currently, the only solution for this use case is to calculate the totals on your server. This way, you will have full control over the totals calculation logic.

You are welcome to contact us if any questions arise.

Kind regards,
Nadia

Please login or Register to Submit Answer