Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

YTD calculation

Hi,

I have only year and month fields. and on selection of year and month, it should give me the addition of  consecutive months (january onwards, upto selected month/year)

For ex, on selecting 2014 March, i want sum of January2014 + february 2014 + march 2014 value.

How can it be done

Thanks.

23 Replies
Not applicable
Author

But i want the YTD value for only selected month and not all months. how can it be done. and why your previous expression doesnt give me the correct value?

tresesco
MVP
MVP

Becasue with dimension expression behavior changes.

If you use text box

exp:=Sum({<Year={$(=only(Year))},Month_Name=, Month={"<=$(=Max(Month))"}>} [DS1Volume])

chart

exp=Aggr(RangeSum(Above(Sum({<Year={$(=only(Year))},Month_Name, Month={"<=$(=Max(Month))"}>} [DS1Volume]),0,RowNo(Total))),Month_Name)

PFA

jyothish8807
Master II
Master II

Hi Aditi,

Try to join both month and Year and  make one field the use that field, may be that can solve your issue.

eg in script:

Month & Year as New_Date,

Then in expression:

Sum({<New_Date={">=$(=YearStart(Max(New_Date)))<=$(=Max(New_Date))"}>} [DS1Volume]))

Regards

KC

Best Regards,
KC
Not applicable
Author

Thanks.