Forum Discussion
adoster
3 years agoResolver I
Rounding to nearest 30 min Time. Code errors out if time is after 11:30PM rounding to next day.
Hello. I am using the following code to create a new column to round to the nearest 30 minutes. = Table.AddColumn(#"Added Conditional Column", "RoundedTime", each Time.From(Number.RoundUp(48*Numb...
- 3 years ago
Oh, sorry about that (it is a bit difficult to double check the syntax when I don't have the full query). This should be the correct version:
Table.AddColumn(#"Added Conditional Column", "RoundedTime", each Time.From(Number.Mod(Number.RoundUp(48*Number.From(Time.From([TABLE_DATE_TIME]))/1)/48, 1)), type time)Note: When I ran the first query I put, I got a different error.
adoster
3 years agoResolver I
Error using the above code.
Expression.Error: We cannot convert the value 1 to type Type.
Details:
Value=1
Type=[Type]
artemus
3 years agoMicrosoft Employee
Oh, sorry about that (it is a bit difficult to double check the syntax when I don't have the full query). This should be the correct version:
Table.AddColumn(#"Added Conditional Column", "RoundedTime", each Time.From(Number.Mod(Number.RoundUp(48*Number.From(Time.From([TABLE_DATE_TIME]))/1)/48, 1)), type time)
Note: When I ran the first query I put, I got a different error.
- adoster3 years agoResolver I
That resolved the issues. Thank you!