MAQL check past date

  • 30 June 2021
  • 1 reply

Hello, I have a question about MAQL.
Is the MAQL syntax able to check the past date?
I have a date of 27/06/2021 then I want to check whether the date has passed 3 days or not.


Best answer by Jakub 30 June 2021, 11:06

View original

1 reply


I noticed you already raised this question on our Slack so I will just recycle the answer provided by my colleague Zuzana:


depends how exactly the metric is going to be used and with what kind of context. But in general you can create metric like this:

SELECT IF (select count (Date (Ticket Created)) WHERE Date (Ticket Created)=THIS-3)=1 THEN 1 ELSE 0 END

Which takes Today date minus 3 days and then it is wrapped in IF condition to get also the other dates but these will be zeroes, only 3 days back is 1. This can be also changed to display YES or NO, e.g. by using metric formatting. e.g.


Would that fit the use case?


Basically you can review our help articles on date arithmetic, using THIS syntax and conditional formatting.


I hope this helps.