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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

calculate the date difference between rows by group

Hi everyone

 

I have a table and I am trying to find the date difference by order ID between stages of an order.

 

JustB_0-1656464354318.png

I would like a column which tells me the number of days an order waits at each stage. As an example order_ID 1 was at stage A on 01 Jan and then stage B at 14 Jan, therefore the number of days at stage A is 13 days.

 

your assistance is appreciated

 

order_IDstagedate allocatedDays  at stage
1A1/01/2022 0:0013
1B14/01/2022 0:001
1C15/01/2022 0:00date now - date allocated
2A2/01/2022 0:00 
2C6/01/2022 0:00 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , New Column

 

=

Datediff([Date], minx(filter(Table, [order_ID] =earlier([order_ID] ) && [Date] > earlier([Date]) ) , [Date]), Day)

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , New Column

 

=

Datediff([Date], minx(filter(Table, [order_ID] =earlier([order_ID] ) && [Date] > earlier([Date]) ) , [Date]), Day)

Anonymous
Not applicable

thank you

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.