Solved

Date Math

  • 14 April 2021
  • 3 replies
  • 48 views

Hello -

I am trying to create a metric for a date last year

for example my selected date filter is 2/01/2021 - I want the answer to be 2/01/2020

 

I also would like to be able to subtract months as well so 02/01/2021 would be 01/01/2021

 

Thank you

icon

Best answer by Iva Gasparekova 10 May 2021, 16:17

Sorry for my misunderstanding of your use-case. Now I understand that you'd like to create something like Min and Max Dates Using Date Arithmetic
Please be aware, this solution is greatly dependant on your model. Please check the example model and MAQL in our documentation and let me know if it is doable in your project.
 

View original

3 replies

Userlevel 2

Hello Linda,

I assume, the prebuilt functionality of Time over Time Comparison isn't exactly what you are looking for, but you can certainly create some Time-over-Time Analytics this way.
Or you can build your own metric/measure via Metric editor and it should be similar to my example below:

 

SELECT metric FOR PreviousPeriod(time_attribute)

I am not sure what you are saying what I am trying to create is something like this

startdate=Select min(Date (Billingdatekey))- 1year

enddate=Select max(Date (Billingdatekey))- 1year

 

that way I can get a metric like this

saleslastyear = select sales where Billingdatekey between startdate and enddate

Userlevel 2

Sorry for my misunderstanding of your use-case. Now I understand that you'd like to create something like Min and Max Dates Using Date Arithmetic
Please be aware, this solution is greatly dependant on your model. Please check the example model and MAQL in our documentation and let me know if it is doable in your project.
 

Reply