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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
shastie
Regular Visitor

Working With Date / Time Formats

Hi, likely a basic question here.

 

I have a table in excel that I would like to link to Powerbi.  The figures in the table are a result of subtracting one date and time away from another to give me a duration. To then put that in to hh:mm in excel that is formatted in excel to a custom format [h]:mm:ss.

 

Exc1.PNG

 

 

When I import this into BI in then shows it as a date / time the same as excel does when you click in the cell. How can i get PowerBI to show the formatted figures?

 

BI1.PNG

Thanks in advance.

 

1 ACCEPTED SOLUTION
FrankAT
Community Champion
Community Champion

Hi @shastie 

you can get it with a calculated column in DAX like this:

 

01-10-_2020_13-21-59.png

 

Formatted = 
VAR _DaysInHours = INT('Table'[DateTime]) * 24
VAR _Hours = INT(MOD('Table'[DateTime],1) * 24)
VAR _Minutes = FORMAT(MOD('Table'[DateTime],1),"nn:ss")
RETURN
    _DaysInHours + _Hours & ":" & _Minutes

With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)

View solution in original post

4 REPLIES 4
FrankAT
Community Champion
Community Champion

Hi @shastie 

you can get it with a calculated column in DAX like this:

 

01-10-_2020_13-21-59.png

 

Formatted = 
VAR _DaysInHours = INT('Table'[DateTime]) * 24
VAR _Hours = INT(MOD('Table'[DateTime],1) * 24)
VAR _Minutes = FORMAT(MOD('Table'[DateTime],1),"nn:ss")
RETURN
    _DaysInHours + _Hours & ":" & _Minutes

With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)

Actually Frank, or anyone else who may be able to help. 

 

While this worked well it has left any blank cells displaying the : seperator between hours and minutes. How do i remove this?

 

shastie_0-1603451679233.png

 

Thanks all, this worked well.

amitchandak
Super User
Super User

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors