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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
psvdr
Frequent Visitor

list timestamp related records in time periods (between start and end time)

Dear Community,

 

I'm asking for your kind help for an M-code soulution for the following:

I'd like to count two type of events occuring in periods. Putting it to tables:

input table 1. periods

period id           start of period
12024-12-01 10:50:42

2

2024-12-02 02:11:10
32024-12-02 08:11:10
42024-12-03 08:11:10
52024-12-05 15:50:00

 

input table 2. events

event type         timestamp
a2024-12-01 10:55:30
b2024-12-02 09:20:14
a2024-12-02 09:21:19
a2024-12-02 19:45:53
a2024-12-02 21:11:56
a2024-12-03 09:00:00
b2024-12-03 09:00:02
b2024-12-04 18:37:55
b2024-12-05 16:13:14

 

expected outcome:

period id         start of period                         event type a          event type b
12024-12-01 10:50:42        1                0

2

2024-12-02 02:11:10        0                0
32024-12-02 08:11:10        3                1
42024-12-03 08:11:10        1                2
52024-12-05 15:50:00        0                1

 

First idea was to create end times from input table 1 start of period data - to have start and end stamps. I succeeded it by creating an index column and a list with List.Range(#"Added Index"[start of period], [Index]+1,1) to have

period idstart of periodstart of next period
12024-12-01 10:50:422024-12-02 02:11:10

2

2024-12-02 02:11:102024-12-02 08:11:10
32024-12-02 08:11:102024-12-03 08:11:10
42024-12-03 08:11:102024-12-05 15:50:00
52024-12-05 15:50:00 

 

but now I'm lost how to search and list timestamps of events in the periods.

Any help would be much appreciated. Thanks in advance.

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@psvdr 

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
ryan_mayu
Super User
Super User

@psvdr 

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Dear ryan_mayu,

You did, and this is the solution. Thank you very much for your super quick response.

Rgds,

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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