Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello guys,
i want to generate one temperate table like below, when i trans one date(2019-01-01) into the temperate table, then it will be set as the field "Date_1"(2019-01-01), for field "Date_2", it will be calculated as one date range from date(2019-01-01) to date+370(2020-01-06), i try to realize in load * inline, but i find inline table doesn't support date function, so could you help me how to achieve this function? thanks for all.
Date_1 | Date_2 |
2019-01-01 | 2019-01-01 |
2019-01-01 | 2019-01-02 |
2019-01-01 | 2019-01-03 |
.. | |
... | |
2019-01-01 | 2020-01-04 |
2019-01-01 | 2020-01-05 |
2019-01-01 | 2020-01-06 |
Hi,
you could try to do it using "for"
Date:
LOAD * INLINE [
Date
2019-01-01
2019-02-01
];
FOR n = 0 to NoOfRows('Date')-1
LET Date = Date#(Peek('Date',$(n),'Date'),'YYYY-MM-DD');
For i = 0 to 370
TABLE:
LOAD
Date('$(Date)') AS Date_1,
Date('$(Date)'+$(i)) AS Date_2
AutoGenerate(1);
NEXT
NEXT
Hi,
you could try to do it using "for"
Date:
LOAD * INLINE [
Date
2019-01-01
2019-02-01
];
FOR n = 0 to NoOfRows('Date')-1
LET Date = Date#(Peek('Date',$(n),'Date'),'YYYY-MM-DD');
For i = 0 to 370
TABLE:
LOAD
Date('$(Date)') AS Date_1,
Date('$(Date)'+$(i)) AS Date_2
AutoGenerate(1);
NEXT
NEXT
Hi StarinieriG,
Yeah, it works to me. Really appreciate for your solution.