Skip to main content
Applications are open for the 2024 Qlik Luminary Program. Apply by December 15 here.
Showing results for 
Search instead for 
Did you mean: 

How to find out MTD Month to Date and LMTD Last Month to Date expression in Qlik Sense?

Hi All,

I am getting confused with below expression which is for :

MTD- Month to Date-> Expression:

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

From above expression I have Year, Month, Quarter as fields but week as function and datefield as date<field>, datenum as Ddate<field> and when I run this expression in pivot table it shows me all dates from previous month to current month.

But MTD, means to get data of current month sales within that current month dates, not previous month dates.....

Same As LMTD facing the issue.

Labels (2)
2 Replies
Specialist III
Specialist III

Do you have any sales that are in August or is Max(DateNum) a July date?


Hi Jwjackso,

I actually found a solution using expression addmonths(monthstart) and addmonths(monthend) to get current month date sales details as MTD and previous month date sale details as LMTD.

But mainly facing a major problem with background expression like in dimension field I have current date for example like Aug2020(1st-20th) dates and want like high/low values in sale details(values are in measure field). Want to show 'Green' background color as 'High sale value' and 'Red' background color as 'Low sale value'.

What can be the expression I can use to write in background field to compare date wise <measure field values> sale details?