Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
abhaysingh
Specialist II
Specialist II

MTD And YTD

=sum({< [Posting Key] = {'XY'}, [Document Type] = {'IND'}   >} [Amount in local Currency])

-

sum({< [Posting Key] = {'AV'}, [Document Type] = {'CNA'}   >} [Amount in local Currency])

How to Write MTD and YTD expression in this ..

Time dimension fields are

Date, Month, Year

Thanks In advance

3 Replies
rahulsud007
Creator
Creator

Hi Abhay, I think this expression may work for you YTD:-

Sum({<[Posting Key] = {'XY'}, [Document Type] = {'IND'} ,Date={'>=$(=Num(YearStart(Max(Date))))<=$(=Max(Date))'}>} Amount in local Currency)

and For MTD

Sum({<[Posting Key] = {'XY'}, [Document Type] = {'IND'} ,Date={'>=$(=(MonthStart(Max(Date))))<=$(=Max(Date))'}}>}Amount in local Currency)

Not applicable

Hi,

Try like this.

MTD,

sum({<Date = {$(=Max(Date) - 12)}, Year = {$(=Max(Year)-1)}, Month = >}[Amount in local Currency] )

YTD,

sum({<Date = {$(=Max(Date))}, Year = {$(=Max(Year))}, Month = >}[Amount in local Currency] )

maxgro
MVP
MVP

example for YTD

=sum({$ <[Posting Key] = {'XY'}, [Document Type] = {'IND'}, Date={">=$(=yearstart(today()))<=$(=today())"}>} [Amount in local Currency])

and MTD

=sum({$ <[Posting Key] = {'XY'}, [Document Type] = {'IND'}, Date={">=$(=monthstart(today()))<=$(=today())"}>} [Amount in local Currency])