You are on page 1of 4

Window-Based Aggregation

Planners can now execute cumulative aggregation on data that has been grouped and sorted based
on selected attributes using the window-based aggregation (IBP WBAGGR) function. For instance, by
making a prioritised list of products for each location using this feature, you can enhance your
production capacity planning.

Within the window-based aggregation function, use the IBP_GROUP_BY embedded function to
group the input data set to create so-called windows. The attributes you choose as parameters for
the function will segment the data. Every time the value of the attribute changes, a new window
opens and the aggregation restarts.

Then, within the windows, use the IBP_SORT_BY embedded function to sort, or subgroup, the data
based on attributes that you define and put them into ascending or descending order.

The aggregation takes place within the windows on the grouped and ordered data set.

Parameters of the Window-Based Aggregation (IBP_WBAGGR) Function

The IBP_WBAGGR function has four mandatory parameters, and they've a fixed order.

1st parameter: input key figure at the input planning level (mandatory)

The parameter value must be surrounded by double quotation marks.

2nd parameter: aggregation type (mandatory)

Possible values are MIN, MAX, SUM, AVG, STDDEV, and COUNT. The aggregation type value must be
surrounded by double single quotes.

3rd parameter: IBP_GROUP_BY embedded function (mandatory)

Planner can use the IBP_GROUP_BY function to group the input data set into segments, also called
windows, within which the aggregation takes place. Each time the value of
the IBP_GROUP_BY attribute changes, the aggregation restarts.

Planner can define multiple parameters in the IBP_GROUP_BY function, but you can only define
attributes as parameters.

Please note that you can define only one PERIODID* as a parameter.

The attributes must be surrounded by double quotes and must be listed within brackets. Their order
doesn’t affect the calculation results.

4th parameter: IBP_SORT_BY embedded function (mandatory)

The IBP_SORT_BY function defines the sort order of the group or window.

Planner can define one or more parameters within this function.

Each parameter is a combination of an attribute and an order modifier, in this order. The possible
values of the order modifier are ASC or DESC. ASC stands for ascending and DESC stands for
descending order.
The attributes must be surrounded by double quotes while the order modifiers must be surrounded
by double single quotes. The parameters must be listed in brackets.

IBP_WBAGGR ("ZFORECAST@MTHPRODLOCCUST",''SUM'', IBP_GROUP_BY ("PERIODID1",


"LOCID"), IBP_SORT_BY ("PERIODID3",''ASC'',"PRDID",''ASC'',"CUSTID",''ASC''))

The data is first grouped based on the attributes defined within the IBP_GROUP_BY embedded
function. The first two attributes, PERIODID1 and LOCID don't create new windows, as their values
don't change. Thus, the calculation will occur for NPL1 location only.

The calculation will restart if the planner introduces another location (NPL2).
After the grouping, the data is sorted along attributes defined within the IBP_SORT_BY embedded
function.

Missing Inputs, NULL Value, and Zero Value

Missing Input

Planner needs to set input key figures for the IBP_WBAGGR function, as no default values are
provided. The window-based aggregation function doesn't generate or complement missing records
and key figure data in case the uploaded data is fragmented or missing.

NULL value

Handling of NULL values of the key figure when the aggregation type is MIN, MAX, SUM, AVG,
or STDDEV:

▪ If the value of a key figure is NULL, it’s regarded as a zero.

▪ If all key figures within a window have NULL values, the output of their aggregation is NULL
too.

Handling of NULL values of the key figure when the aggregation type is COUNT:
▪ If the value of a key figure is NULL, it isn't added to the counter.

▪ If all key figures within a window have NULL values, their aggregation returns zeros.

Attributes with NULL values are listed at the top of the sorted list.

Zero value

In case of zero values, zeros are used in the calculations.

Modeling Requirements for the Window-Based Aggregation (IBP_WBAGGR) Function

▪ The IBP_WBAGGR function must have values specified for the four parameters: the input
key figure, the aggregation type, the IBP_GROUP_BY, and the IBP_SORT_BY embedded
functions.

▪ The parameters are all mandatory and have a fixed order.

▪ The input planning level and the output planning level of the window-based aggregation
must be compatible with each other. That is, they must contain the same set of attributes,
including the same set of root attributes.

▪ The window-based aggregation function works both for stored and calculated key figures.

▪ The IBP_WBAGGR function can't be used at REQUEST level.

▪ The IBP_WBAGGR function can't be nested in other calculations.

▪ When a calculation graph includes a window-based aggregation, the topmost key figure in
the calculation graph mustn't be editable.

▪ The IBP_WBAGGR function can't be used in the calculation graph - at base planning level and
below - of a key figure that is used either as the input or output of a supply or forecast
operator.

Useful Hints for Testing the IBP_WBAGGR Function

▪ Use the Simulate Key Figure Calculations app to test the IBP_WBAGGR function. You can
view the inputs and the output much easier with it.

▪ Try the COUNT aggregation first to check your calculation.

You might also like