Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have the monthly Sales data per PersonID like below.
PersonID | Year | YearMonth | Sales |
P1 | 2016 | 201601 | 1 |
P1 | 2016 | 201602 | 2 |
P1 | 2016 | 201603 | 3 |
P1 | 2016 | 201604 | 4 |
P1 | 2016 | 201605 | 5 |
P1 | 2016 | 201606 | 6 |
P1 | 2016 | 201607 | 7 |
P1 | 2016 | 201608 | 8 |
P1 | 2016 | 201609 | 9 |
P1 | 2016 | 201610 | 10 |
How to calculate YTD Sales Average?
Expression: sum(Sales)/count(distinct Month)
avg({<YearMonth={">=$(=YearStart(Max(YearMonth)))<=$(=Max(YearMonth))"}>} Sales)
Try this
avg({<Year = {'$(=Max(Year))'}>}Sales)
avg({<YearMonth={">=$(=YearStart(Max(YearMonth)))<=$(=Max(YearMonth))"}>} Sales)
Hi Aretha
For your case of Avg.qvw,
try
sum({<Year={$(=Max(Year))},YearMonth={"<=$(=max(YearMonth))"}>} Sales)/count({<Year={$(=Max(Year))},YearMonth={"<=$(=max(YearMonth))"}>}distinct Month)