Solved

MAQL check past date

  • 30 June 2021
  • 1 reply
  • 103 views

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

icon

Best answer by Jakub 30 June 2021, 11:06

View original

1 reply

Hi,

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.

[=0]NO;[=1]YES;

Would that fit the use case?

 

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

https://help.gooddata.com/doc/enterprise/en/dashboards-and-insights/maql-analytical-query-language/maql-use-cases-and-tutorials/date-attribute-arithmetic

https://help.gooddata.com/doc/enterprise/en/dashboards-and-insights/maql-analytical-query-language/maql-use-cases-and-tutorials/finding-min-and-max-dates-using-date-arithmetic

etc.

I hope this helps.

Best,

Jakub

 

Reply