The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello
I have data where the hours are numbered 1-24 and stored as whole numbers
I would like to convert these to actual times s0 00:00, 01:00, 02:00 etc and then add them to my date column to create a datetime.
I;ve tried used #duration and subtracting -1 from Hour but I get 00:00 as the time for every hour, regardless of which one it was originally.
Where am I going wrong?
Solved! Go to Solution.
Without your code it is hard to say where you went wrong.
This is working code:
let Source = Table.FromColumns({{1..24},List.Dates(#date(2017,6,9),24,#duration(1,0,0,0))},type table[hours = Int64.Type, date = date]), #"Added Custom" = Table.AddColumn(Source, "time", each #time(0,0,0)+#duration(0,[hours]-1,0,0)), #"Inserted Merged Date and Time" = Table.AddColumn(#"Added Custom", "datetime", each [date] & [time], type datetime) in #"Inserted Merged Date and Time"
Without your code it is hard to say where you went wrong.
This is working code:
let Source = Table.FromColumns({{1..24},List.Dates(#date(2017,6,9),24,#duration(1,0,0,0))},type table[hours = Int64.Type, date = date]), #"Added Custom" = Table.AddColumn(Source, "time", each #time(0,0,0)+#duration(0,[hours]-1,0,0)), #"Inserted Merged Date and Time" = Table.AddColumn(#"Added Custom", "datetime", each [date] & [time], type datetime) in #"Inserted Merged Date and Time"
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
80 | |
71 | |
52 | |
50 |
User | Count |
---|---|
129 | |
123 | |
78 | |
64 | |
60 |