3 Replies Latest reply: Jan 25, 2018 8:36 AM by Sunny Talwar

# YTD Calculation in Table

Hi,

Can anybody please suggest about YTD calculation in table with filter selection on dimension. I am able to write below code which works fine if value are selected in filter but doesn't work if no value are selected.

If(GetSelectedCount(Period)=1,

aggr(rangesum(Below(total sum({<Period=>}Value),0,\$(vMonthDiff))),Period),

aggr(rangesum(Below(total sum({<Period=>}Value),0,Right(Period,2))),Period))

• ###### Re: YTD Calculation in Table

After what selection does this work? I tried selecting Period and it doesn't seem to be working... am I missing something here?

• ###### Re: YTD Calculation in Table

Hi Sunny,

When you also select vaue from AccCls and AccN then it is working.

Please suggest other approach to calculate YTD.

Thanks,

• ###### Re: YTD Calculation in Table

Check this

If(GetSelectedCount(Period)=1,

aggr(rangesum(Below(Sum({<Period=>}Value),0,\$(vMonthDiff))), AccCls, AccNm, Period),

aggr(rangesum(Below(Sum({<Period=>}Value),0,Right(Period,2))),AccCls, AccNm, Period))