• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Filtering with Power Query

Joe Shaer

New Member
Dear all,

I am new to Power Query and was asked to do a multi-criteria filter in a dataset.

I have a dataset with several columns. I need to filter two columns: 'orderdate' 'city' column. I would like to filter-out or delete only the rows which contain 'orderdate' BEFORE April 2020 specifically for the City of 'Boston'.

How would I do this without needing to use a formula? Attached is the sample file

Thank you,
Joe
 

Attachments

  • Sample - Joe.xlsx
    31 KB · Views: 4
Joe Shaer
... new to Power Query ...
then this should be open in Power Query- forum ...
as You've read from Forum Rules.
>> moved to there <<
 
Load data to PowerQuery. Then enter Query editor.

Click on pull down menu beside column name.
Select Date/Time Filters and then "Custom Filter".
83036

Then select "Advanced" and set OrderDate "AND" City criteria.
83037

NOTE: This is just example of how to do it. Since I wasn't exactly sure what end result you wanted.
 
See attached where:
Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Sales_Data3"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"OrderDate", type date}, {"Region", type text}, {"City", type text}, {"Category", type text}, {"Product", type text}, {"Quantity", Int64.Type}, {"UnitPrice", type number}, {"TotalPrice", type number}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([City] = "Boston")),
    #"Filtered Rows1" = Table.SelectRows(#"Filtered Rows", each [OrderDate] < #date(2020, 4, 1))
in
    #"Filtered Rows1"
 

Attachments

  • Chandoo51293Sample - Joe.xlsx
    39.4 KB · Views: 1
Back
Top