Hi All,
I am new to business objects Webi. I have been working on below requirement
Below is how my detailed level data looks like
Calmonth | Plant | Material - Key | Cores - Returned | Cores - Not Returned |
Mar-16 | ABC | 1234 | -33 | 57 |
Mar-16 | ABC | 1235 | 20 | -1 |
Mar-16 | ABC | 1236 | 0 | 5 |
Mar-16 | ABC | 1237 | 0 | 3 |
Mar-16 | ABC | 1238 | 1 | 9 |
Apr-16 | ABC | 1239 | 1 | -1 |
Apr-16 | ABC | 1240 | 5 | 3 |
Apr-16 | ABC | 1241 | -1 | 1 |
Apr-16 | ABC | 1242 | 2 | 0 |
For each material I need to check if either of the 2 Metrics are negative, if yes I need to exclude that material from aggregation (aggregation at calmonth level). So my final aggregation should look like
Calmonth | Cores - Returned | Cores - Not Returned |
Mar-16 | 1 | 17 |
Apr-16 | 7 | 3 |
I have tried below approach:
created 2 new variables as below:
1.Sum(If((([Cores - Returned]>=0) And ([Cores - Not Returned]>=0));[Cores - Not Returned];0))ForEach([calmonth;plant;material])
2.Sum(If((([Cores - Returned]>=0) And ([Cores - Not Returned]>=0));[Cores - Returned];0))ForEach([calmonth;plant;material])
Below is the output for above 2 variables along with my original metrics
Calmonth | Plant | Material - Key | Cores - Returned | Cores - Not Returned | Cores - Returned (New) | Cores - Not Returned (new) |
Mar-16 | ABC | 1234 | -33 | 57 | 0 | 0 |
Mar-16 | ABC | 1235 | 20 | -1 | 0 | 0 |
Mar-16 | ABC | 1236 | 0 | 5 | 0 | 5 |
Mar-16 | ABC | 1237 | 0 | 3 | 0 | 3 |
Mar-16 | ABC | 1238 | 1 | 9 | 1 | 9 |
Apr-16 | ABC | 1239 | 1 | -1 | 0 | 0 |
Apr-16 | ABC | 1240 | 5 | 3 | 5 | 3 |
Apr-16 | ABC | 1241 | -1 | 1 | 0 | 0 |
Apr-16 | ABC | 1242 | 2 | 0 | 2 | 0 |
and I tried to aggregate these 2 variables at calmonth assuming that it will calculate before aggregation (nullifying materials with negative metrics and then aggregate) But it is not working. below is what I got :
Calmonth | Cores - Returned | Cores - Not Returned |
Mar-16 | -12 | 73 |
Apr-16 | 7 | 3 |
So I think calculation (of variables) is happening after aggregation even though I used for each.
Please let me know if my understanding of context aggregation is wrong and also if there is any way to achieve this requirement. Thanks in advance.
Regards,
Aditya