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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
hrishi
Helper I
Helper I

generate time stamp between two time stamps?

Hello Everyone,

so I have these time stamps - 

Start TimeEnd Time

01/01/2022 10:00 AM 

                                                   

01/01/2022 10:30AM
 01/01/2022 11:30 AM01/01/2022 12:00PM

 

I want to generate the time stamp in between these two time stamps.

could you please guide me
It cannot be a measure. 

 

desired output : 

                                                   

Start TimeEnd Time  
01/01/2022 10:00 AM01/01/2022 10:30AM 
01/01/2022 10:30 AM01/01/2022 11:30AM 
01/01/2022 11:30 AM01/01/2022 12:00PM 



Thanks in advance 🙂 🙂 

1 ACCEPTED SOLUTION

Hi, @hrishi 

My mistake, I just found out that I added the function "SAMPLE" to limit the result to 3 lines.(I added the sample function just to facilitate the sorting of Column ‘Start Time’)

Please modify my original formula as follows:

 

New Table = 
    UNION (
        SELECTCOLUMNS ( 'Table', "Start Time", 'Table'[Start Time] ),
        SELECTCOLUMNS ( 'Table', "Start Time", 'Table'[End Time] )
    )

 

12.png

Hope this could work for you.

 

Best Regards,
Community Support Team _ Eason

View solution in original post

7 REPLIES 7
hrishi
Helper I
Helper I

I am trying to create a simulation in power BI.

Hi, @hrishi 

Try formuals as below:
Add a new calculated Table:

New Table = 
SAMPLE (
    3,
    UNION (
        SELECTCOLUMNS ( 'Table', "Start Time", 'Table'[Start Time] ),
        SELECTCOLUMNS ( 'Table', "Start Time", 'Table'[End Time] )
    ),
    [Start Time], ASC
)

Add a new calculated column:

End Time =
CALCULATE (
    MIN ( 'New Table'[Start Time] ),
    FILTER (
        'New Table',
        'New Table'[Start Time] > EARLIER ( 'New Table'[Start Time] )
    )
)

6.png

Please check my sample file for more details.

 

Best Regards,
Community Support Team _ Eason

You are close to the solution however, we are missing the first time duration ie. 1/1/2022 10:00 AM  - 1/1/2022 10:30 AM. and also the next time row 1/1/2022 10:30 AM - 1/1/20222 11:30 AM

Hi, @hrishi 

My mistake, I just found out that I added the function "SAMPLE" to limit the result to 3 lines.(I added the sample function just to facilitate the sorting of Column ‘Start Time’)

Please modify my original formula as follows:

 

New Table = 
    UNION (
        SELECTCOLUMNS ( 'Table', "Start Time", 'Table'[Start Time] ),
        SELECTCOLUMNS ( 'Table', "Start Time", 'Table'[End Time] )
    )

 

12.png

Hope this could work for you.

 

Best Regards,
Community Support Team _ Eason

You are awesome 🙂 🙂 

vojtechsima
Memorable Member
Memorable Member

Hi, @hrishi 
I am not sure what you're trying to accomplish,
You want duration between two datetimes or you have let's say 1/1/2022 10:00 AM and then you have 1/1/2022 12:30 and you want to generate timestamp in between, each after let's say 30 minutes?
So the outcome would be:
1/1/2022 10:30 AM
1/1/2022 11:00 AM
1/1/2022 11:30 AM

I have update the post.
Hopefully it helps.

 

Thank you!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.