Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have the following data in the script :
Type | CurrentTripDate |
Travel | 12/02/2019 |
from the backend I need to output a table in the format below. I need hep generating the table.
Type | CurrentTripDate | Last12monthends |
Travel | 12/02/2019 | 2019/01/31 |
Travel | 12/02/2019 | 2018/12/31 |
Travel | 12/02/2019 | 2018/11/30 |
Travel | 12/02/2019 | 2018/10/30 |
Travel | 12/02/2019 | 2018/09/30 |
Travel | 12/02/2019 | 2018/08/31 |
Travel | 12/02/2019 | 2018/07/31 |
Travel | 12/02/2019 | 2018/06/30 |
Travel | 12/02/2019 | 2018/05/31 |
Travel | 12/02/2019 | 2018/04/30 |
Travel | 12/02/2019 | 2018/03/31 |
Travel | 12/02/2019 | 2018/02/28 |
Something like this?
Data: LOAD Type, CurrentTripDate ... FROM ... Join(Data) LOAD Date(Floor(MonthEnd(Today(), -1 - RowNo()))) as Last12MonthEnds Autogenerate 12;
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
Something like this?
Data: LOAD Type, CurrentTripDate ... FROM ... Join(Data) LOAD Date(Floor(MonthEnd(Today(), -1 - RowNo()))) as Last12MonthEnds Autogenerate 12;