locked
Write a new query from a single query RRS feed

  • Question

  • I have created a query from OData connection say "Productlist". The columns in productlist query are closing date(eg 21.4.2014), product name and its id. How to take the last 7days of product with respect to the closing date( lyk: 21.4.2014-7). How to create a query for this scenario?
    Friday, March 21, 2014 6:37 AM

Answers

  • The Power Query UI lets you add a filter on a Date column to only keep rows from last week.

    Firstly, make sure you column has the right type from the Power Query editor ribbon (it should be Date).

    Go to the filter drop down for that column in the column header, go to Date Filters, and select Last Week.

    Does that work for you or do you want to query the last 7 days specifically?

    Thanks


    Zafar Abbas

    Friday, March 21, 2014 9:29 PM

All replies

  • The Power Query UI lets you add a filter on a Date column to only keep rows from last week.

    Firstly, make sure you column has the right type from the Power Query editor ribbon (it should be Date).

    Go to the filter drop down for that column in the column header, go to Date Filters, and select Last Week.

    Does that work for you or do you want to query the last 7 days specifically?

    Thanks


    Zafar Abbas

    Friday, March 21, 2014 9:29 PM
  • In addition to Zafar's proposed solution, I wanted to point out that a "Last N days" filter (where N is provided by the user) is something that we are working on for one of our next updates (1-2 months out).

    Thanks,
    M.

    Saturday, March 22, 2014 3:55 PM
  • I didnt want to wait for the Last.N.Filter so i figured out the following:

    = Table.SelectRows(RemovedColumns, each [DATE] >=  (DateTime.FixedLocalNow() - #duration(7, 0, 0, 0) ))

    works fine for me

    greetings from germany

    Friday, May 16, 2014 3:14 PM