Showing results for 
Search instead for 
Did you mean: 

Display average for line items

Former Member
0 Kudos

I have a query with a fixed row structure basically line items restricting on specific cost centers. I have my column structure where my key figures are alone with date restrictions, etc. Part of my query requires the user to specify the date interval for the data they want to see: Production date: 8/01/2008 - 8/12/2008 for example, but instead of the total for that date range for each line item in my row structure, they want to see the month-to-date average of the production for that time period. I have tried to do the option of Average for all values under the local calculations, but it still gives me the total, so I'm assuming that only applies to the result rows. The option for aggregation is grayed out. Temporarily, I have given them an input variable to enter 12 for the number of days and done the division in a formula, but I don't want to continue to have to do that if there is a better way.

Accepted Solutions (0)

Answers (1)

Answers (1)

Active Contributor
0 Kudos

We have implemented something similar using formula variables to calculate the number of days between an input date range interval. Ex. ZPRDDATE is the input variable they enter 8/1/2008 - 8/31/2008

Have two formula variables which are derived from ZPRDDATE in auser exit:

Start Date = From value of ZPRDDATE (8/1 in this case)

End Date = To Value of ZPRDDATE (8/12 in this case)

Build 3 formulas in your query:

Start Date = Start Date variable

End Date = End Date Variable

Diff Daus = End Date - Start Date

The n you can calculate the avg in a formula