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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
clarkpaul
Helper I
Helper I

Return the Average Start Time by Route Identifier and Ignore Blanks

The source data has duplicate Route Identifiers and duplicate Route Start Times.  I'm trying to find the
average Route Start Time without duplicates and ignore blank values.
Below is a sample of the data:

clarkpaul_0-1645548863414.png

Any help would be appreciated!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @clarkpaul ,

 

Create a calculated column to convert the time to seconds.

_seconds = HOUR('Table'[Start Times])*3600+MINUTE('Table'[Start Times])*60+SECOND('Table'[Start Times])

1.PNG

Then create a measure like below.

Measure = 
var _avg = SUMX(ALL('Table'),'Table'[_seconds])/CALCULATE(COUNT('Table'[Identifiers]),'Table'[Start Times]<>BLANK())
return
VAR hours =
    ROUNDDOWN ( _avg / 3600, 0 )
VAR minutes =
    ROUNDDOWN ( MOD ( _avg, 3600 ) / 60, 0 )
VAR seconds =
    INT ( MOD ( _avg, 60 ) )
VAR milliseconds =
    round(MOD ( _avg, 1 ) * 100,0)
RETURN
    FORMAT(hours,"00") & ":"
        & FORMAT(minutes, "00")
        & ":"
        & FORMAT(seconds, "00")

2.jpg

 

Best Regards,

Jay

View solution in original post

2 REPLIES 2
clarkpaul
Helper I
Helper I

Perfect, thank you!

Anonymous
Not applicable

Hi @clarkpaul ,

 

Create a calculated column to convert the time to seconds.

_seconds = HOUR('Table'[Start Times])*3600+MINUTE('Table'[Start Times])*60+SECOND('Table'[Start Times])

1.PNG

Then create a measure like below.

Measure = 
var _avg = SUMX(ALL('Table'),'Table'[_seconds])/CALCULATE(COUNT('Table'[Identifiers]),'Table'[Start Times]<>BLANK())
return
VAR hours =
    ROUNDDOWN ( _avg / 3600, 0 )
VAR minutes =
    ROUNDDOWN ( MOD ( _avg, 3600 ) / 60, 0 )
VAR seconds =
    INT ( MOD ( _avg, 60 ) )
VAR milliseconds =
    round(MOD ( _avg, 1 ) * 100,0)
RETURN
    FORMAT(hours,"00") & ":"
        & FORMAT(minutes, "00")
        & ":"
        & FORMAT(seconds, "00")

2.jpg

 

Best Regards,

Jay

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors