on ‎2015 Sep 24 10:17 AM
Hello,
We have a simple allocation of values from an account CUSTOMERS, based on a factor existing in a PERCENT account.
The CUSTOMERS account has to be an integer, so after the allocation we perform a round to obtain the correct value. The problem is, after the round, in some cases, the total does not match the value that was allocated in the first place:
PERCENT CUSTOMERS
Product NA 1346
Product 1 0.27 363.42 363
Product 2 0.35 471.1 471
Product 3 0.11 148.06 148
Product 4 0.27 363.42 363
SUM = 1345
In these cases, we want to determine the difference between the value after the round and the initial value to allocate and put this difference in the product that has the highest value, in this example, Product 2.
Our issue is how to find this member. I've found no MAX function in script logic and the only solution I'm seeing so far is to have all this values in a XDIM_MEMBERSET, store the first one in a temporary account, compare the next value with this temporary, if it is higher replace the value and so on, but it doesn't seem a good solution, we are talking about a huge amount of data, so all these comparisons will be slow...
Any ideas?
Thanks!
Lara
Request clarification before answering.
Hi Lara,
Your proposal with temporary account may be not so bad At least why not to test it!
Theoretically you can also create a custom measure with MAX or use some MDX calculations... Both will be very slow!
But I recommend to perform this in the badi - only few lines of code...
Vadim
P.S. The issue with the script is like: if you have 2 exactly same top amounts then delta will be written twice...
P.P.S. "Your proposal with temporary account may be not so bad" - will be bad - you will have to use slow FOR/NEXT loop to write value before the next comparison!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 4 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.