Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ericdelaqua
Creator
Creator

Generate dates in the script

Hello,

I have the following data in the script :

TypeCurrentTripDate
Travel12/02/2019

 

from the backend I need to output a table in the format below. I need hep generating the table.

TypeCurrentTripDateLast12monthends
Travel12/02/20192019/01/31
Travel12/02/20192018/12/31
Travel12/02/20192018/11/30
Travel12/02/20192018/10/30
Travel12/02/20192018/09/30
Travel12/02/20192018/08/31
Travel12/02/20192018/07/31
Travel12/02/20192018/06/30
Travel12/02/20192018/05/31
Travel12/02/20192018/04/30
Travel12/02/20192018/03/31
Travel12/02/20192018/02/28
Labels (2)
1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Something like this?

Data:
LOAD Type, 
	CurrentTripDate
	...
FROM ...

Join(Data)
LOAD Date(Floor(MonthEnd(Today(), -1 - RowNo()))) as Last12MonthEnds
Autogenerate 12;
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

2 Replies
pradosh_thakur
Master II
Master II

First make sure your dates are in date format and not string

What is the logic for the first date, please mention that, for the output you mentioned try below

if(rowno()=1,DATE#('2019/01/31','YYYY/MM/DD'), date(monthend(addmonths(peek(Last12monthends),-1)),'YYYY/MM/DD')) as Last12monthends
Learning never stops.
jonathandienst
Partner - Champion III
Partner - Champion III

Something like this?

Data:
LOAD Type, 
	CurrentTripDate
	...
FROM ...

Join(Data)
LOAD Date(Floor(MonthEnd(Today(), -1 - RowNo()))) as Last12MonthEnds
Autogenerate 12;
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein