Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
please refer to the attached file.I made the Inline data, where I have 2 Years, Months and Amounts. In 2016 the Amounts are NULL.
I want to make an average, of the Amount when 2 Years are selected, but this does not work now:
sum(Amount1) / (12 * GetSelectedCount(Year))
I got number 5, when 2 Years are selected, but should be 10.
Next Year I will have data for this Amount for both Years.
I cannot use AVG!, because of nested aggregation, since I already do sum (so this example is not precise)
Can you please suggest better expression?
Thank you.
If you have real nulls in the data, you could try like:
=sum(Amount1) /(12 * Count(DISTINCT {<Amount1={'*'}>}Year))
If not really nulls but no amount (some other values like, space or other invisible characters), try like:
=sum(Amount1) /(12 * Count(DISTINCT {<Amount1={"=Len(Trim(Amount1))>0"}>}Year))
Maybe this
=avg(Aggr(Sum(Amount1),Year,Month))
Regards
Pratyush
You can also try this
=Sum(Amount1)/Count(DISTINCT Year&Month)
If you have real nulls in the data, you could try like:
=sum(Amount1) /(12 * Count(DISTINCT {<Amount1={'*'}>}Year))
If not really nulls but no amount (some other values like, space or other invisible characters), try like:
=sum(Amount1) /(12 * Count(DISTINCT {<Amount1={"=Len(Trim(Amount1))>0"}>}Year))
still gives 5 in model example and doesnt work on my app.
Ok, so what is it evaluating in your app?
Regards
Pratyush
Perfect, Thank you.