Forum Discussion
Split rows
- 5 years ago
Hi wiktorius1984 ,
I have a question about how you calculate the number of rows however the first approach since you always want the same value do the following:
- Add a custom column with the following code:
Text.Start( Text.Repeat( Number.ToText(0.25) & "," , [Value]/0.25), Text.Length(Text.Repeat( Number.ToText(0.25) & "," , [Value]/0.25))-1)Only question here is about the last part of the syntax that should be chjange to give you the correct number of rows (not understanding why 4 gives you a result of 8 rows).
- Do a split column by rows:
final result and code below:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcq1IzC3ISTU0UNJRMtAzVYrVgYsZAYVMlGJjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [text = _t, Value = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"text", type text}, {"Value", type number}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Text.Start( Text.Repeat( Number.ToText(0.25) & "," , [Value]/0.25), Text.Length(Text.Repeat( Number.ToText(0.25) & "," , [Value]/0.25))-1)), #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(#"Added Custom", {{"Custom", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Custom"), #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Custom", type number}}) in #"Changed Type1"
Hi wiktorius1984 ,
I have a question about how you calculate the number of rows however the first approach since you always want the same value do the following:
- Add a custom column with the following code:
Text.Start( Text.Repeat( Number.ToText(0.25) & "," , [Value]/0.25),
Text.Length(Text.Repeat( Number.ToText(0.25) & "," , [Value]/0.25))-1)
Only question here is about the last part of the syntax that should be chjange to give you the correct number of rows (not understanding why 4 gives you a result of 8 rows).
- Do a split column by rows:
final result and code below:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcq1IzC3ISTU0UNJRMtAzVYrVgYsZAYVMlGJjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [text = _t, Value = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"text", type text}, {"Value", type number}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Text.Start( Text.Repeat( Number.ToText(0.25) & "," , [Value]/0.25),
Text.Length(Text.Repeat( Number.ToText(0.25) & "," , [Value]/0.25))-1)),
#"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(#"Added Custom", {{"Custom", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Custom"),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Custom", type number}})
in
#"Changed Type1"
thanks for help, you are right in case of value 4 there must be 16 rows 🙂 thx