Hello,
I'm experiencing problems when using measures defined by formulas and the datasource API.
For instance, in the following example https://jsfiddle.net/mp123456/34kqw8hn/1/,
Am I doing something wrong?
Thanks in advace.
Hello,
Thank you for contacting us.
Our team would like to kindly explain that there is no need to create the calculated value in order to specify some particular aggregation from the chosen hierarchy. It is enough to add the aggregation
property and specify the desired aggregation as its value, for example:
{
"uniqueName": "Price",
"aggregation": "average"
}
Calculated values should be used when some additional calculations need to be applied on measures, in your case such hierarchies are named "Average Quantity plus Total Price" and "Total plus Average Price".
We have modified your example in the way everything work as expected. It is achievable using the approach described above instead of creating a new calculated value for each required aggregation.
We recommend referring to our tutorial on configuring the slice
object in order to get more information about the recommended ways to choose hierarchies to display and adjust them in the desired way.
Our team sure hopes it helps.
Do not hesitate to contact us in case additional questions occur.
Best regards,
Illia
Hello,
Thank you for the response. I agree that individual computations such as "sum('Price')" are more easily computed with an aggregation instead of a formula.
However, the example just intended to show that the application sometimes fails to retrieve the desired data. I just build a simple example with your sample data so that you can see the error I get.
In the original example, in the POST request named "select", it can be seen that the average of price is never asked for, and I think this is not the behaviour to be expected.
I've copied the POST request I refer to:
{"index":"fm-product-sales","page":0,"query":{"aggs":{"by":{"cols":[{"uniqueName":"Category"}],"rows":[{"uniqueName":"Country"}]},"values":[{"field":{"uniqueName":"Price"},"func":"sum"},{"field":{"uniqueName":"Price"},"func":"sum"},{"field":{"uniqueName":"Price"},"func":"sum"},{"field":{"uniqueName":"Price"},"func":"sum"},{"field":{"uniqueName":"Quantity"},"func":"average"},{"field":{"uniqueName":"Quantity"},"func":"average"},{"field":{"uniqueName":"Price"},"func":"sum"}]}},"type":"select"}
Thank you for your help.
Best regards
Hello,
Thank you for the detailed information about the problem.
Our team is going to research the issue.
We will provide you with results ETA May 18.
You are welcome to contact us in case any other questions arise.
Best regards,
Illia
Hello,
Thank you, I look forward to your response.
Best regards
Hello,
We are pleased to inform you that the issue with missed measures in the calculated values was fixed.
This is provided in the 2.8.7 version of Flexmonster: https://www.flexmonster.com/release-notes/.
You are welcome to update the component.
Here is our updating to the latest version guide for assistance: https://www.flexmonster.com/doc/updating-to-the-latest-version/.
Please let us know if everything works fine for you.
Best regards
Hello,
Thank you for the update, I will try it out.
Best regards
Hello,
Our team is wondering whether our fix did manage to resolve the problem with missed measures in the calculated values.
We are looking forward to hearing from you.
Kind regards,
Illia