Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Can you do a different aggregate calculation in the total of a pivot table .

     Can you do a  different aggregate calculation in the total  of a pivot table .

I have a pivot table that has a calculation as the measure

I would like to have the total as an avg of the rows

5 Replies
luciancotea
Specialist
Specialist

=if( Dimensionality() = 1

    , sum(Qty)

    , avg(Qty)

    )

Gysbert_Wassenaar

You can use the dimensionality() function. Something like if(dimensionality()=0, avg(aggr(sum(Sales),Product)),sum(Sales)) in a pivot table that has Product as dimension and Sales as a measure for the calculations.


talk is cheap, supply exceeds demand
cesaraccardi
Specialist
Specialist

Hi Oliver,

Since the pivot table doesn't have the option to change the Total mode of the expressions in the properties dialog like the straight table, you will have to do that in your expressions. If it's just a simple average of the calculations you can achieve that using the AGGR function (advanced aggregation). For example:

avg(aggr(sum(Value),Dimension))

Please let me know if you need more information,

Cesar

Not applicable
Author

Thanks for your suggestion

my calc is a little different

=if (RegMonth =ActivityPeriod30,200,sum(Rev))

the resulting sum  will always be the else condition .

Should the if condition be in  set analysis . How would the calculation be written?

Not applicable
Author

select COUNT (*) ,MONTH(c.created_at) 

from tbStageF_content  (nolock) c

where

creator_source=100

and  year(c.created_at) =2013

and MONTH(c.created_at) >= 1

group by

MONTH(c.created_at)

order by 2