Forum Discussion

LoxleyLearner's avatar
LoxleyLearner
New Member
5 years ago
Solved

Delete rows - based on one blank column only

I'm looking at the BP world energy report and have the tall thin dataset downloaded.  It uses ISO3 values (great) but in the ISO3 column has blanks for regional summaries (not so great as these sum t...
  • v-lionel-msft's avatar
    5 years ago

    Hi LoxleyLearner ,

     

    Is it like this?

    Please try this M code.

    let
        Source = Excel.Workbook(File.Contents("C:\Users\lionelch\Desktop\Sampledata\Data\content\Chapter_1\2015 Sales.xlsx"), null, true),
        Sales_Table = Source{[Item="Sales",Kind="Table"]}[Data],
        #"Changed Type" = Table.TransformColumnTypes(Sales_Table,{{"CountryRegion", type text}, {"Brand", type text}, {"Month", type text}, {"Sale 2013", type any}, {"Sale 2014", type number}, {"Sale 2015", Int64.Type}}),
        #"Filtered Rows" = Table.SelectRows(
            #"Changed Type", 
            each 
            ([CountryRegion] <> null and [CountryRegion] <> "") and
            ([Brand] <> null and [Brand] <> "") and
            ([Month] <> null and [Month] <> "") and
            ([Sale 2013] <> null and [Sale 2013] <> "") and
            ([Sale 2014] <> null and [Sale 2014] <> "") and
            ([Sale 2015] <> null and [Sale 2015] <> "")
        )
    in
        #"Filtered Rows"

     

    Best regards,
    Lionel Chen

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.