Forum Discussion
double format for a single column
- 2 years ago
Hi, I assume that you dont want to summarize the column, right ? (you you do, I would suggest that you convert with conditional column everything to hours (if contains ":", then multiply by 24, and next add":00").
But if you want just to adjust the format in one column, you could add a calculated column (just simply formatted column = original column, which would use dynamic formatting, for which you would create a condition, that if it contains ":" then format as hours, if not, then format as days....
Since the integers represent Days, you cannot type it as Time as the PQ Time data type will not accept hours > 24.
To type it as duration, ensure that PrevStep has the column typed as Text. Then you can use the code line:
#"Type as Duration" = Table.TransformColumns(PrevStep,
{"Period", each
if not Text.Contains(_,":") then #duration(Number.From(_),0,0,0) else
let
x = Text.Split(_,":"),
dy = 0,
hr =Number.From(x{0}),
min = try Number.From(x{1}) otherwise 0,
sec = try Number.From(x{2}) otherwise 0
in
#duration(dy,hr,min,sec),
type duration})
To represent the values in some other manner, please be specific.