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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Kudoed Authors