Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all,
I have a measure field "Target" for every month for Salesperson.. Measure field calc = avg(Target)
I am having issue calculating YTD Target... I need to calculate Avg( Avg(Jan Target), Avg(Feb Target)) So as the month progresses, it should automatically consider the average of next month in the YTD calculation.
So I tested the below condition and this works.. and the result is as I expected.. But I have hardcoded monthnum here. I need to automatically do the same condition from Yearstart to max(date)...
(Avg({<SalesYear={$(=Max(SalesYear))},MonthNum={1}>}Target)
+ Avg({<SalesYear={$(=Max(SalesYear))},MonthNum={2}>}Target))
/ Max(Month(Salesdate))
The goal is not to hardcode the months.. it should automatically consider in YTD calculation.
Please give me suggestions on how to resolve this.
I'd suggest an aggr to calculate the averages by month and then average the total for the salesperson -
avg({<SalesYear={$(=Max(SalesYear))},MonthNum={"<=$(max(MonthNum)+1)"}>}aggr(avg(Target),MonthNum,Salesperson))
MonthNum={"<=$(max(MonthNum)+1)"} is looking at the next month assuming you have current month selected, although you may need to consider what happens at year end.
I'd suggest an aggr to calculate the averages by month and then average the total for the salesperson -
avg({<SalesYear={$(=Max(SalesYear))},MonthNum={"<=$(max(MonthNum)+1)"}>}aggr(avg(Target),MonthNum,Salesperson))
MonthNum={"<=$(max(MonthNum)+1)"} is looking at the next month assuming you have current month selected, although you may need to consider what happens at year end.
Works like a charm! Thanks a lot @MikeA . Appreciate it.