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: 
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.