This one is not for the faint hearted lol.
- Functionality is to have ability to capture business policies at different levels of the hierarchy. Business policies have customer and product as dimensions. The customer/product list levels is configurable.
- Customer list has the following hierarchy: Country ⇒ Channel ⇒ Customer ⇒ Store. So C1 to C4 list
- Product list has the following hierarchy: Category ⇒ Sub Category ⇒ SKU. So P1 to P3 list
- There are 2 parts to the problem:
- 1. First part is to enable list level at which a business policies are captured (entered) is to be configurable. I have one module with C4 and P3 dimensions and each business policy is a line item and have another configuration module where users enter the customer/product levels in which a business policy is captured. For example, business policy ABC can be configured to be entered at C2/P1 and business policy XYZ can be configured to be entered at C3/Top level. Users can even change the configuration of policy ABC from C2/P1 to C3/P2 as they wish. This part I have already implemented
- 2. Second part is now to propagate data entered at higher levels down to the lowest level. So if data was captured at C2/P1, I need to propagate that data down to C4/P3 dimensions. In theory data the entered at C2/P1 would flow down to C3/P2 then C4/P3. So a bit like a reverse of Average Summary for a line item. Difference is data is flowing down to leaf not from leaf to top level. Or if it can go straight from C2/P1 to C4/P3 then better. I have already implemented the C2/P1 to C4/P3 directly but just hate it cause it has too many if else statements in it and I am looking for a better option. I think there may also be an option of creating the whole hierarchy as a flat list (e.g. P1 to P3 as in a product flat list that includes all of P1 to P3) then do a SUM on selected levels but don't want to do that either.
Below is an example of the hierarchies. An input and output expected