Forum Discussion
Anonymous
6 years agoNot applicable
Print the column values with multiple times like concatenate
Hi there,
I am looking for the output similar to one above using either Power Query or DAX.
Cheers,
- Anonymous6 years ago
this code dynamically applies logic to all columns subsequent to the first.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTICYgOlWJ1oMMsYzoOwdJRMwDwTKM8YzDOFqjRSio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [key = _t, ABC = _t, XYZ = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"ABC", Int64.Type}, {"XYZ", Int64.Type}}), cols=Table.ColumnNames(#"Changed Type"), nCols=List.Count(cols), #"Added Custom" = Table.AddColumn(#"Changed Type", "out", (r)=> Text.AfterDelimiter( Text.Combine(List.Transform({1..nCols-1}, (c)=> Text.Repeat(":|"&cols{c},Record.FieldValues(r){c}) )),":|")) in #"Added Custom" - Anonymous6 years ago
10 Replies
- AnonymousNot applicable
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTICYgOlWJ1oMMsYzoOwdJRMwDwTKM9YKTYWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [key = _t, ABC = _t, XYZ = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"ABC", Int64.Type}, {"XYZ", Int64.Type}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "out", each Text.AfterDelimiter(Text.Repeat(":|ABC",[ABC]) &Text.Repeat(":|XYZ",[XYZ]),":|")) in #"Added Custom"if you don't need a more general solution that doesn't rigidly depend on the name of the columns,an unclear point for me is the fact that only a few lines must have text. but it is not explained which or by what criteria to choose- AnonymousNot applicable
Hi Anonymous
the logic is it should be based on the value present in the respective column, if it is 0 then no need to display concatenate value.
- AnonymousNot applicable
"the logic is it should be based on the value present in the respective column, if it is 0 then no need to display concatenate value."
why, then, is the second line empty?