Forum Discussion
jcabeza
5 years agoFrequent Visitor
generate a list with two intervals power query
I have a few hours of beginning and end, and I want to generate a list to later expand in rows, but when the hours pass to the next day I need a list to be generated until 23 hours and then to start ...
- 5 years ago
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjJW0lEyVIrVATKNgEwDCBMkCiTgwiB2LAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Start = _t, End = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Start", Int64.Type}, {"End", Int64.Type}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if [End]<[Start] then List.Transform({[Start]..[End]+24}, each if _>=24 then _-24 else _) else {[Start]..[End]}), #"Extracted Values" = Table.TransformColumns(#"Added Custom", {"Custom", each Text.Combine(List.Transform(_, Text.From), ","), type text}) in #"Extracted Values"
CNENFRNL
5 years agoCommunity Champion
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjJW0lEyVIrVATKNgEwDCBMkCiTgwiB2LAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Start = _t, End = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Start", Int64.Type}, {"End", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if [End]<[Start] then List.Transform({[Start]..[End]+24}, each if _>=24 then _-24 else _) else {[Start]..[End]}),
#"Extracted Values" = Table.TransformColumns(#"Added Custom", {"Custom", each Text.Combine(List.Transform(_, Text.From), ","), type text})
in
#"Extracted Values"