Forum Discussion

yogeshmaney's avatar
yogeshmaney
Helper I
6 years ago
Solved

CreateTable in Power Query

Hello,

 

In PowerQuery, How can we use Create Table from an existing table by filtering rows? 

 

Thanks

 

  • Hi

    I referenced DataSet &

    Tried Following

     

    let
    Source = Data1,
    #"Added Custom" = Table.AddColumn(Source, "Index", each if [Location] = "US" then "" else 0/1),
    #"Changed Type" = Table.TransformColumnTypes(#"Added Custom",{{"Index", type binary}}),
    #"Removed Errors" = Table.RemoveRowsWithErrors(#"Changed Type", {"Index"}),
    #"Removed Columns" = Table.RemoveColumns(#"Removed Errors",{"Index"})
    in
    #"Removed Columns"

     

    Its Working for me. 

8 Replies

  • Geradav's avatar
    Geradav
    Responsive Resident

    Hi yogeshmaney 

     

    Not sure to clearly understand your question but I am thinking you could Reference an existing query and apply the desired filters.

     

    Inside Power Query Editor, right-click a query in the Queries pane (left side) and click "Reference".

    It will create a new query (new table) dependant on the first one. Then you apply your filters as desired.

     

    Let us know if that works for you.

     

    Best

     

    David

    • yogeshmaney's avatar
      yogeshmaney
      Helper I

      Thanks David. 

      But referencing is Duplicating Data. I need to create a new Table by filtering rows.

      Tried Table.RemoveRows but giving error

      • Geradav's avatar
        Geradav
        Responsive Resident

        yogeshmaney 

         

        Can you provide some screenshots and examples of your current scenario and the desired output?

         

        Best

         

        David