Calculating Average based in Decile Values

Hi,  I have few Records of below Data Struture in Mendix.    Now, i need to calculated the Average of Sales for each Decile and update in the attribute next to it. I could calculate the Average Sales for all Records, but i’m not sure how to calculate for each Decile in Microflow. Please help  
1 answers

You could add an AvgSales attribute to your entity, and add a Before Commit event handler to call a microflow to calculate this automatically. The microflow would just need to divide the Sales by Orders and set the new AvgSales attribute. but not commit it. This means whenever you try to commit the entity, the value would be recalculated.

Hope this helps.