Forum Discussion
joshua1990
2 years agoPost Prodigy
Append same query based on Criteria
Hi all!
I have a table like this:
Article
Date
Value
Key 1
Key 2
Key 3
Key 4
A1
5
AB
A2
5
AB
AC
AD
A3
5
AC
AD...
- 2 years ago
A simple unpivot would do the trick
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjRU0lECIlMgdnSCsEEoVgcoZ4Qm5+gMIlzg8sYIeRRZR1el2FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Article = _t, Date = _t, Value = _t, #"Key 1" = _t, #"Key 2" = _t, #"Key 3" = _t, #"Key 4" = _t]), #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Article", "Date", "Value"}, "Attribute", "Key"), #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Other Columns",{"Attribute"}), #"Filtered Rows" = Table.SelectRows(#"Removed Columns", each [Key] <> null and [Key] <> "") in #"Filtered Rows"
Vijay_A_Verma
2 years agoMost Valuable Professional
A simple unpivot would do the trick
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjRU0lECIlMgdnSCsEEoVgcoZ4Qm5+gMIlzg8sYIeRRZR1el2FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Article = _t, Date = _t, Value = _t, #"Key 1" = _t, #"Key 2" = _t, #"Key 3" = _t, #"Key 4" = _t]),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Article", "Date", "Value"}, "Attribute", "Key"),
#"Removed Columns" = Table.RemoveColumns(#"Unpivoted Other Columns",{"Attribute"}),
#"Filtered Rows" = Table.SelectRows(#"Removed Columns", each [Key] <> null and [Key] <> "")
in
#"Filtered Rows"