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: 
d_koti24
Creator II
Creator II

question on mtd,ytd,pytd

how to write expressions for mtd,ytd,pytd,qtd?

regards,

koti

3 Replies
MK_QSL
MVP
MVP

MTD

=SUM({<InvoDate = {">=$(=MonthStart(Max(InvoDate)))<=$(=MonthEnd(Max(InvoDate)))"}>}Sales)

YTD

=SUM({<InvoDate = {">=$(=YearStart(Max(InvoDate)))<=$(=Max(InvoDate))"}>}Sales)

PYTD

=SUM({<InvoDate = {">=$(=YearStart(Max(InvoDate),-1))<=$(=YearEnd(Max(InvoDate),-1))"}>}Sales)

QTD

=SUM({<InvoDate = {">=$(=QuarterStart(Max(InvoDate),-1))<=$(=QuarterEnd(Max(InvoDate),-1))"}>}Sales)

Change Max(InvoDate) to Today() if you want to get all these results with respect to Today

Not applicable

Hi,

try something like this:

Sum({<YearField = {$(#=Max(YearField))},MonthField = {"<=$(#=Num((Max(MonthField)))"} >} myField) // YTD

Sum({<YearField = {$(#=Max(YearField))},MonthField = {$(#=Num(Max(MonthField)))}, DayField = >} myField) // MTD

Best regards.