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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Learner_SG
Helper IV
Helper IV

power query time format change

Hi , could anyone tell me what is the power query formula to change the hour into hh:mm format 

this is what I used in DAX. But I would like to change it in power query.
Time = Format(measurement[Hours]/24,"hh:mm").Tks.
4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

@Learner_SG I believe you would just use the divide method in Power Query and then change the type to Duration.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTICYmMgNlGK1SFLJBYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [One = _t, Two = _t, Three = _t, Four = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"One", Int64.Type}, {"Two", Int64.Type}, {"Three", Int64.Type}, {"Four", Int64.Type}}),
    #"Divided Column" = Table.TransformColumns(#"Changed Type", {{"One", each _ / 24, type number}}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Divided Column",{{"One", type duration}})
in
    #"Changed Type1"


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler , thanks for the reply. I tried with your formula but it just displays one time only and it does not give different time values as per the time table. 

 

My intention is that based on my hour value table which is in 24 hr format , I need to display it in the graph which will show  as below.

Learner_SG_0-1647245927049.png

When I used the time column which is hh:00 format which was created in dax it gives me the date also inside(31/12/1899)

Learner_SG_1-1647246042391.png

 

even though I tried to change the column to time format. So I wanted to create the table in power query and try.

 

Hi @Learner_SG 

 

Another limitation is that the slicer you want to have is a range slicer, but currently Power BI only has numeric range slicer and date range slicer. It only supports to put a numeric type column or a date type column into a slicer and switch it to Between mode, just like the screenshot you show. It doesn't support other data types or data formats. 

Use the numeric range slicer in Power BI - Power BI | Microsoft Docs

 

You could raise an idea at Ideas (powerbi.com) and let other people vote it up. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

@Learner_SG There is no true Duration data type in Power BI even though it exists in Power Query. It is stored as a decimal number with the hours, minutes, seconds as /24, /24/60 and /24/60/60. So, you will need to use a custom format string along the lines of Chelsie Eiden's Duration. https://community.powerbi.com/t5/Quick-Measures-Gallery/Chelsie-Eiden-s-Duration/m-p/793639#M389



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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