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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Issue in YTD expression

Hi all,

I need to show May YTD in my expression.

so, i gave the following expression

sum

({<Year={$(vYear)},Month={">$(vFirstPeriod)<$(=vMonth)"}>}sales/1000

vYear  =Year(Today())

vFirstPeriod = Month(YearStart(Today()))

vMonth=Month(MonthStart(Today())-1)

which is 2014, Jan to May.

kindly correct me where i went wrong.

Thanks in advance,

sheela

7 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Use $ expansion even on the last variable (rfemove the =):

sum({<Year={$(vYear)},Month={">$(vFirstPeriod)<$(vMonth)"}>}sales/1000)

Not applicable
Author

Hi Alessandro, Still i am getttin only 0 in the column.

mdmukramali
Specialist III
Specialist III

Dear,

Can you share the sample file.

Thanks,

Mukram

alexandros17
Partner - Champion III
Partner - Champion III

Could you try the same expression without dividing by 1000?

jagan
Partner - Champion III
Partner - Champion III

Hi,


Try like this


What is your month format? Is it 1,2,3, or Jan, Feb, Mar?  If it is 1,2 3, then try below expression


=sum({<Year={$(vYear)},Month={'<=$(=vMonth)}>}sales/1000)


or if you have a date field then try this expression


=sum({<YearDimensionName={$(vYear)},MonthDimensionName=, DateDimensionName={'<=$(=MonthEnd(Today(), -1))'}>}sales/1000)


Replace YearDimensionName,MonthDimensionName, DateDimensionName with your actual field names.


Hope this helps you.


Regards,

Jagan.


Not applicable
Author

Thanks fr your repli,

but it dint work

Regards,

Vidhya

jagan
Partner - Champion III
Partner - Champion III

Hi,

Can you attach sample file and expected output?

Regards,

Jagan.