Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

YTD calculation using GetFieldSelection

I have some reports that populate the data within them by using the Get Field Selection function.  For example the user must select a month and year, and then the report will populate that dates selected units:

 

Sum({< detailmonth = {"$(=GetFieldSelections(detailmonth))"}, detailyear = {"$(=GetFieldSelections(detailyear))"} >} units)

This works great for getting month selected units, prior month, month over month comparision, prior year, and year over year comparison.  Now I need to get the YTD based on the month selected.  Meaning if they selected month 5  and year 2012 that it would sum months 1-5 for 2012, or if month 8 then sum months 1-8.  Anybody have suggestions on how to do this? I'm drawing a blank based on current design.

Thanks,

Rebecca

1 Solution

Accepted Solutions
MayilVahanan

HI

Try like this

Sum({<MonthField=,YearField=,DateField={">=$(=YearStart(Max(DateField)))<=$(=MonthEnd(Max(DateField)))"}>} FieldName)"

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

2 Replies
MayilVahanan

HI

Try like this

Sum({<MonthField=,YearField=,DateField={">=$(=YearStart(Max(DateField)))<=$(=MonthEnd(Max(DateField)))"}>} FieldName)"

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Perfect!  Thank you Mayil!  I was putting the <= in the wrong place.  I appreciate your help!!  Thanks again!