Forum Discussion

Dennis154's avatar
Dennis154
New Member
8 years ago
Solved

Power-Query - Foreach or any other

Hi,   this is a produced Example to show the problem.   i have a Table named: Car_each_Country like this: Car          Deutschland    Frankreich   Russland VW               x                   ...
  • Greg_Deckler's avatar
    8 years ago

    I think that you may be overcomplicating this one. You should just need your first table:

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCgtX0lGqgONYnWilgPyi4oxUJGGwqE9iSiKIDUYQhUGpeYmlOSUwIZDCWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Car = _t, Deutschland = _t, Frankreich = _t, Russland = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Car", type text}, {"Deutschland", type text}, {"Frankreich", type text}, {"Russland", type text}}),
        #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Car"}, "Attribute", "Value"),
        #"Filtered Rows" = Table.SelectRows(#"Unpivoted Columns", each ([Value] = "x")),
        #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Value"}),
        #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Attribute", "Country"}})
    in
        #"Renamed Columns"