Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
ramkrishna86
Creator II
Creator II

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))

Also, Please find attached QVF.

Thanks in Advance!

1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

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))

View solution in original post

3 Replies
sunny_talwar
MVP
MVP

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

Capture.PNG

ramkrishna86
Creator II
Creator II
Author

Hi Sunny,

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

Please suggest other approach to calculate YTD.

Thanks,

sunny_talwar
MVP
MVP

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))