If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.
I've got a table with clients debts looking like this
I want to make a measure, calculating average debt over dates, and then sum it over customers.
The obvious way is to use Aggr:
My_Measure = sum(aggr(sum([Debt]) / count(distinct Date), Customer))
and it works fine for a table with Customer as a dimension:
But if I change the Dimension to [Date], I get the wrong result, since Aggr aggregates Date before it looks for Dimension in Table:
Of course, I can rewrite measure like this
sum(aggr(sum([Debt]) / count(distinct Date), Date, Customer))
but in this case the Total result does not work correctly (it sums to 340)
Is there any workaround, how to make this measure work correctly with Customer OR Date as dimension, and woth correct Totals?
And can I make ot work corectly with any dimensions from linked tables (for example, Month, Year, Customer_Region etc._)
I think you want to use your 2nd expression:
If you change the "Totals function" to Avg in the Properties panel for the measure, it will give you the correct total. It should also work if you use other dimensions.
In that case , the customer based value will show total as 85