business-objectswebi

Calculate weekly average of column in Webi


I have a table with 3 columns in SAP Webi as shown in the picture.

In column "weekly average" I want to dynamically calculate the weekly average (from Monday to Sunday) of column "count".

Is it possible to do it with a variable? If not, any suggestions how to do it with other methods?

Thanks.

enter image description here


Solution

  • Yes, this can be done. Two steps: first create a variable to define a single value for each week, then another to return the average of those values.

    For step 1, create a new variable ("Date Week") with the following definition:

    =LastDayOfWeek([Date])
    

    Then, in the report block (where your "Weekly Average" column is), create this formula:

    =Average([Count]) in ([Date Week])
    

    This should produce the result you want.