cancel
Showing results for 
Search instead for 
Did you mean: 

Calculated member for average based on Columns count

rodney_rivera22
Explorer
0 Kudos

Hi,

I'm trying to get the formula to be able to calculate the average value based on a total amount divided by the count of columns (Months) inside a Cross Tab report. 

Month 1Month 2Month 3Month 4Month 5Month 6TotalAverage
Sales (by month count)
10040030010006003002700450 = ( 2700 / 6)

How I can get the number of columns in a dynamic way?  by the way, I'm using SAP Crystal Reports 2013.

Can someone help me with this formula? I'll appreciate any help

Thanks,

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Rodney,

Assuming you already have the Calculated Member column setup, you'd use the following code as its Calculation Formula:

GetTotalValueFor("Month Field", 0) / (GetNumColumns-2)

Notice how I've surrounded the 'Month Field' with double quotes and not the usual curly braces for database field.

-Abhilash

rodney_rivera22
Explorer
0 Kudos

Thanks Abhilash...

Now I want to move the "Average" column to be after the "Total" column.  How can I do that?

Thanks again

Answers (0)