We have updated Flexmonster Software License Agreement, effective as of September 30, 2024. Learn more about what’s changed.

Aggregation type "product" behaves different in latest versions

Answered
Viacheslav asked on January 4, 2023

After upgrading a version, we faced an issue in our reports that aggregations do not work properly anymore.
Here is a JsFiddle example. Change library version in HTML section to see the difference in behaviour between v2.9.40 and v2.7.23. Take a loot at "Average Daily Rate" and "RevPAR" columns.
We have the following measures:

measures": [
  {
    "uniqueName": "Average Daily Rate",
    "caption": "Average Daily Rate",
    "formula": "sum('Revenue') / sum('Room Nights')",
    "aggregation": "product",
    "format": "adrFormat"
  },
  {
    "uniqueName": "RevPAR",
    "caption": "RevPAR",
    "aggregation": "product",
    "format": "adrFormat",
    "formula": "average('Average Daily Rate') * average('Occupancy')"
  }
]

3 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster January 5, 2023

Hi, Viacheslav,

Thank you for reaching out to us and providing us with the sample.

Kindly note that Flexomnster skips the aggregation property if the measure is calculated.
In the sample, we noticed that the "Average Daily Rate" and "RevPAR" fields are already present in the data source. Flexmonster v2.9.40 shows those values from the data source and ignores the formula property if its uniqueName is already used.
We suggest setting the different names for the calculated values, for example:

"measures": [
        {
          "uniqueName": "Average Daily Rate Formula",
          "caption": "Average Daily Rate",
          "formula": "sum('Revenue') / sum('Room Nights')",
          "aggregation": "sum",
          "format": "adrFormat"
        },
        {
          "uniqueName": "RevPAR Formula",
          "caption": "RevPAR",
          "aggregation": "sum",
          "format": "adrFormat",
          "formula": "average('Average Daily Rate') * average('Occupancy')"
        }
      ]

Feel free to check the following JSFiddle for reference: https://jsfiddle.net/flexmonster/L5xwvs3f/ 

Please let us know if such an approach would work for your case. Looking forward to hearing from you.

Kind regards,
Nadia

Public
Viacheslav January 11, 2023

Thank you! It helped to solve an issue.
It would be good to update a migration guide, specifying that in a newer version, there were changes on how FlexMonster treats duplicated fields in data source.

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster January 13, 2023

Hello, Viacheslav,

Thank you for the feedback.

We are glad to hear that it works for you. Regarding the update of a migration guide, we have mentioned such a behavior in our release notes: https://www.flexmonster.com/release-notes/version-2-8-9/

You are welcome to write to us in case further questions arise.

Kind regards,
Nadia

Please login or Register to Submit Answer