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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
rkalantan
New Member

Difference between two flight arrival & departure

Hi 

If you are familiar with transit between flights, I want to calculate the hours difference betwen arrival of flights and departure of another flights, this is sample of data:

 

Halph AlphaKeyDept StaArvl StaDept TimeArvl TimeWeekday
JEDDXBDXBJEDDXBJED5:056:00Monday
JEDCAIJEDCAIJEDCAI8:0510:30Monday
JEDCAICAIJEDCAIJED11:0513:00Monday
JEDDXBJEDDXBJEDDXB15:0517:00Monday

 

the measure created will calculate the transit time from DXB-CAI & CAI-DXB taking into consideration that JED is the hub airport where all conections take place 

DXB to JED arrive to JED at 6:00 AM & JED depart to CAI at 8:05 AM, so it is 2 hours transit time at JED airpot. Also, flights from CAI arrive at JED at 13:00 PM and flights to DXB depart from JED at 15:05 so it is 2 hours connection

 

so how can we crete a measure to do that ?

2 REPLIES 2
ERD
Community Champion
Community Champion

@rkalantan ,

If this is what you're trying to achieve, you can try the next approach:

ERD_0-1653074356519.png

Create an Index column in Power Query:

ERD_1-1653074451897.png

Create a measure:

time_diff = 
VAR a_time = MAX ( 'Table'[Arvl Time] )
VAR b_time =
    CALCULATE (
        MIN ( 'Table'[Dept Time] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Index] > SELECTEDVALUE ( 'Table'[Index] ) )
    )
VAR diff = DATEDIFF ( a_time, b_time, MINUTE )
RETURN
    RIGHT ( "0" & INT ( diff / 60 ), 2 ) & ":"
        & RIGHT ( "0" & INT ( MOD ( diff, 60 ) ), 2 )

If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.

Stand with Ukraine! 
1) https://bank.gov.ua/ua/about/support-the-armed-forces
USD:
BENEFICIARY: National Bank of Ukraine
BENEFICIARY BIC: NBUA UA UX
BENEFICIARY ADDRESS: 9 Instytutska St, Kyiv, 01601, Ukraine
ACCOUNT NUMBER: 400807238
BENEFICIARY BANK NAME: JP MORGAN CHASE BANK, New York
BENEFICIARY BANK BIC: CHASUS33
ABA 0210 0002 1
BENEFICIARY BANK ADDRESS: 383 Madison Avenue, New York, NY 10017, USA
PURPOSE OF PAYMENT: for crediting account 47330992708
Accounts details for other currencies (EUR|GBP|CHF|AUD|CAD|PLN) can be found here: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

Will try it and let you know ,, thanks for the hep

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.