I have the following expression in a pivot table measure:
aggr( count(distinct WorkDate),WorkMonth,WorkYear,BusUnit)
It works at the WorkMonth level but I would like to get the average as a total for the year. Please advise...thank you.
You can use dimensionality() function to change the behaviour of your expression based on the level of aggregation you are.
For example:
If(Dimensionality()=2
,aggr( count(distinct WorkDate),WorkMonth,WorkYear,BusUnit)
,aggr(avg(aggr( count(distinct WorkDate),WorkMonth,WorkYear,BusUnit)),WorkYear,BusUnit))
You can use dimensionality() function to change the behaviour of your expression based on the level of aggregation you are.
For example:
If(Dimensionality()=2
,aggr( count(distinct WorkDate),WorkMonth,WorkYear,BusUnit)
,aggr(avg(aggr( count(distinct WorkDate),WorkMonth,WorkYear,BusUnit)),WorkYear,BusUnit))
Thanks Vincent; I believe this will work.