Forum Discussion

Tober1996's avatar
Tober1996
Helper I
6 years ago
Solved

Table filtering while import

Hello experts, I would like to import a table whose first column contains an order number, but for which there are several rows, since there are different processes for each order. now i don't want to import every process, but only the process with the highest process number per order. how can i filter this before i import the data into powerbi. the table actually has 250000 lines.

Thanks for help,
Tober
  • Hi Tober1996 ,

     

    Please try grouping like this:

    Add a step in the advanced editor after expanding the table:

    Table.SelectRows(#"Expanded expand",each([Max]=[expand.flow_id]))

    Sample .pbix

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

  • Tober1996's avatar
    Tober1996
    6 years ago

    Hi together, thank you very much! The advanced grouping ist the solution, but it is not needed to write the extra code to see the other columns. You only have to press the button with the two arrows in the headline of the new column. than all existings columns expand and are shown again. ğŸ˜„ 

7 Replies

  • mahoneypat's avatar
    mahoneypat
    Microsoft Employee

    You can use Group By in the query editor to group on ID and get the max Process Order.

     

    https://support.office.com/en-us/article/group-rows-in-a-table-power-query-e1b9e916-6fcc-40bf-a6e8-ef928240adf1

     

    Alternatively, you could creat a subgroup index on process order for each ID, and then filter to "1" on the new index column.  See this article on creating a subgroup index.

    https://www.youtube.com/watch?v=7CqXdSEN2k4

     

    If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat

     

  • V-lianl-msft's avatar
    V-lianl-msft
    Community Support

    Hi Tober1996 ,

     

    Transform data before importing. In the queries editor,click the "group by" button then group by max process number of each order.

     

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

    • Tober1996's avatar
      Tober1996
      Helper I

      Hi, thanks to all for your solutions. I tried Lian's solution (it looked like the easiest -for me-). But my table has a lot of columns and after using lian's solution, there are only the two columns from the grouping. I would like that the other columns of the selected max line are still available. Is this possible?

      • AlB's avatar
        AlB
        Community Champion

        Hi Tober1996 

        Can you please share a sample of your input data so that we can see the structure of the table and  provide an example of what you need based on that data? Show what the result would be. Please paste the data here in text-tabular format so that it can be copied (instead of a screen cap)

        Please mark the question solved when done and consider giving kudos if posts are helpful.

        Contact me privately for support with any larger-scale BI needs

        Cheers