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

Populate values between start date and end date

Hello All!

I have a small problem with one of my reports, rather than using IntervalMatch I need to populate the values between the start and end for each record. I have attached an example report to show the set of data I'm currently using.

Ideally, I'd like the complete hours populated between the start_timestamp and end_timestamp, i.e.

This is my record at the moment:

   

idstart_timestampend_timestamp
529/03/2017 15:5330/03/2017 07:19

And I'd like to show:

    

idstart_timestamptimestampend_timestamp
529/03/2017 15:5329/03/2017 15:0030/03/2017 07:19
529/03/2017 15:5329/03/2017 16:0030/03/2017 07:19
529/03/2017 15:5329/03/2017 17:0030/03/2017 07:19
529/03/2017 15:5329/03/2017 18:0030/03/2017 07:19
529/03/2017 15:5329/03/2017 19:0030/03/2017 07:19
529/03/2017 15:5329/03/2017 20:0030/03/2017 07:19
529/03/2017 15:5329/03/2017 21:0030/03/2017 07:19
529/03/2017 15:5329/03/2017 22:0030/03/2017 07:19
529/03/2017 15:5329/03/2017 23:0030/03/2017 07:19
529/03/2017 15:5330/03/2017 00:0030/03/2017 07:19
529/03/2017 15:5330/03/2017 01:0030/03/2017 07:19
529/03/2017 15:5330/03/2017 02:0030/03/2017 07:19
529/03/2017 15:5330/03/2017 03:0030/03/2017 07:19
529/03/2017 15:5330/03/2017 04:0030/03/2017 07:19
529/03/2017 15:5330/03/2017 05:0030/03/2017 07:19
529/03/2017 15:5330/03/2017 06:0030/03/2017 07:19
529/03/2017 15:5330/03/2017 07:0030/03/2017 07:19

Can someone help me, please?

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Well, may be this then ?

Load

  *,

  Timestamp(Floor(start_timestamp, 1/24)+IterNo()*1/24) as timestamp

While Floor(start_timestamp, 1/24)+(IterNo()-1)*1/24 <=end_timestamp;

load

  Timestamp#(start_timestamp,'DD/MM/YYY hh:mm') as start_timestamp,

  Timestamp#(end_timestamp,'DD/MM/YYY hh:mm') as end_timestamp

Inline [

id, start_timestamp, end_timestamp

5, 29/03/2017 15:53, 30/03/2017 07:19]

View solution in original post

4 Replies
tresesco
MVP
MVP

May be like:

=Interval(Timestamp#( end_timestamp,'DD/MM/YYY hh:mm')-Timestamp#( start_timestamp,'DD/MM/YYY hh:mm'),'hh:mm:ss')

Dayna
Creator II
Creator II
Author

That only seems to give a value between those dates, rather than populating missing values? Isn't it more like a cartesian timeframe?

tresesco
MVP
MVP

Well, may be this then ?

Load

  *,

  Timestamp(Floor(start_timestamp, 1/24)+IterNo()*1/24) as timestamp

While Floor(start_timestamp, 1/24)+(IterNo()-1)*1/24 <=end_timestamp;

load

  Timestamp#(start_timestamp,'DD/MM/YYY hh:mm') as start_timestamp,

  Timestamp#(end_timestamp,'DD/MM/YYY hh:mm') as end_timestamp

Inline [

id, start_timestamp, end_timestamp

5, 29/03/2017 15:53, 30/03/2017 07:19]

Dayna
Creator II
Creator II
Author

You're an absolute star.. thank you!