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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Bajdak
Frequent Visitor

Duration between 2 dates with DirectQuery

Hello, 

 

i need to calculate the duration between two dates. It should be in time or number format.
It should be possible to visualize the average of the Duration.

Bajdak_0-1676549033231.png

In addition it should work with DirectQuery.

1 REPLY 1
marcelsmaglhaes
Super User
Super User

Hey @Bajdak 

 

You need to use the duration functions: Duration functions - PowerQuery M | Microsoft Learn

 

For example, to take the duration in days you can use:

 

=each Duration.Days([Date1] - [Date2])


If this posts helps, please mark my answer as a solution! 

Best Regards,
Marcel


Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI

If I've helped, don't forget to mark my post as a solution!



Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.