Forum Discussion

marcp's avatar
marcp
Icon for Helper I rankHelper I
8 years ago
Solved

Measure counting products with test on date

Hi, I am stuck here is my issue   i have a table1 of items with 2 columns : item, date-ref There is no duplicate in that table1   and a table2 of sale transactions tr_id, date-sale, item, qty...
  • kingcondie's avatar
    8 years ago

    Hi marcp

     

    I am a bit new to this, and there is probably a more straight-forward way.  I suggest the following steps:

    Make a query from table 2

    merge table 1 based on item

    expand columns to include the ref date

    Add a column that says "Keep" if the date-sale is >= ref date or "Drop" otherwise

    Filter the new column to keep the "Keep" values

    Group by date-sale and item, making a column called measure1 that counts rows

     

    I think that should get you where you want to be.

     

    kingcondie