Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
In the attached example, how can I calculate the average over all weekdays versus the average over just days with sums?
Try this
If(Dimensionality() = 0,
Sum(Aggr(Avg(Aggr(Sum(Visit),Hour,WeekDay,Location))/Avg(Aggr(Count(DISTINCT Visit),Hour,WeekDay,Location)),Hour,WeekDay,Location))/Count(DISTINCT TOTAL WeekDay),
Avg(Aggr(Sum(Visit),Hour,WeekDay,Location))/Avg(Aggr(Count(DISTINCT Visit),Hour,WeekDay,Location)))
What is your expected output for the two numbers and which object do you need this in?
Is this you want to see?
avg(aggr(sum(Visit),Hour,WeekDay,Location))
In the avg pivot, I would like the average calculation to treat the nulls, '-', as zero values.
Try this
If(Dimensionality() = 0,
Sum(Aggr(Avg(Aggr(Sum(Visit),Hour,WeekDay,Location))/Avg(Aggr(Count(DISTINCT Visit),Hour,WeekDay,Location)),Hour,WeekDay,Location))/Count(DISTINCT TOTAL WeekDay),
Avg(Aggr(Sum(Visit),Hour,WeekDay,Location))/Avg(Aggr(Count(DISTINCT Visit),Hour,WeekDay,Location)))
Simplified version of the expression
If(Dimensionality() = 0,
Sum(Aggr(Avg(Visit),Hour,WeekDay,Location))/Count(DISTINCT TOTAL WeekDay),
Avg(Visit))
Thank you Sunny. This is very helpful. I have not used dimensionality very much.