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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
azmeerrehan
Partner - Creator
Partner - Creator

Cumulative Month Issue

I am using a set analysis expression and my data is a Month to Date Data. I want to calculate the YTD  up to the current month my date format is 'YYYYMM'

I have tried the following :

sum({$<CalendarYear = {$(=Max(CalendarYear)-1)},CalendarMonthName={"<=$(vMonthToday()"}>} Sales)

where vMonth is my variable defined as Month(Today()).

Can anyone please help.

5 Replies
Anil_Babu_Samineni

If this is working for you

sum({$<CalendarYear = {$(=Max(CalendarYear)-1)},CalendarMonthName={"<=$(vMonthToday()"}>} Sales)

Then, YTD may be this?

Sum({<Year=, Month=, Quarter=, Week=, CalendarYear={">=$(=Num(YearStart(Max(CalendarYear))))<=$(vMonthToday)"}>} Sales)


But, If you ask please share YTD formula for that expression i would write like below

Sum({<Year=, Month=, Quarter=, Week=, CalendarYear={">=$(=Num(YearStart(Max(DateField))))<=$(=Num(Max(DateField)))"}>} Sales)



Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
azmeerrehan
Partner - Creator
Partner - Creator
Author

NO my original expression is not working that is why I posted it

aarkay29
Specialist
Specialist

may be this for current YTD


sum({$<Date={"<=$(=date(today(),'YYYYMM'))>=$(=date(yearStart(today()),'YYYYMM'))"}>} Sales)

Anil_Babu_Samineni

May be try this?

sum({$<CalendarYear = {">= $(=Date(Max(CalendarYear),'YYYYMM')-1) <=$(=Date(Month(Today()),'YYYYMM'))"}>} Sales)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
azmeerrehan
Partner - Creator
Partner - Creator
Author

Sorry doesn't work

=sum({$<CalendarYear = {">= $(=Date(Max(CalendarYear),'YYYYMM')-1) <=$(=Date(Month(Today()),'YYYYMM'))"}>}  Sales)

We are in June right now, So I would like to compare June /2017 and June 2016,