Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
mike_spada
Contributor III
Contributor III

Average as last column in Pivot

Hi everyone,

I need to create a pivot table and I'm stuck for a thing that I thougth it was easy... how can I insert a column - like the "Totals" in pivot - with Average instead of total sum?

I need to have something like this:

sample1.png

working collapsed too:

sample2.png

Can someone help me please?

I attach a qvw as sample.

Thank you in advance!

Mike

 

Labels (2)
1 Solution

Accepted Solutions
Frank_Hartmann
Master II
Master II

Maybe like attached.

add an Inline table to the script:

Load * Inline [

dim

1

2

];

 

then use following 3 dimensions: Area, Year, pick(dim,Month,'Avg')

expression: If(pick(dim, Amount, 'Avg')<>'Avg', sum({ <Customer>}Amount),sum(Total <Customer,Area> Amount) /count(DISTINCT( Month)))

 

View solution in original post

2 Replies
Frank_Hartmann
Master II
Master II

Maybe like attached.

add an Inline table to the script:

Load * Inline [

dim

1

2

];

 

then use following 3 dimensions: Area, Year, pick(dim,Month,'Avg')

expression: If(pick(dim, Amount, 'Avg')<>'Avg', sum({ <Customer>}Amount),sum(Total <Customer,Area> Amount) /count(DISTINCT( Month)))

 

mike_spada
Contributor III
Contributor III
Author

Thank you, it works!

Mike