Most Recent Criteria

Hi All,
I have a delivery column with before and after text selection options. I would like to use these two as criteria to sum all values from the latest “before delivery” up to the latest “after delivery”.

like this table: from the most recent "Before Delivery to the Most Recent “After Delivery”= 111
image

thanks

Try:

SUM(
  SELECT(
    MyTable[Sales],
    AND(
      (
        [Date] >= MAX(
          SELECT(
            MyTable[Date],
            ("Before Dlivery" = [Before or After Delivery])
          )
        )
      ),
      (
        [Date] <= MAX(
          SELECT(
            MyTable[Date],
            ("After Dlivery" = [Before or After Delivery])
          )
        )
      )
    )
  )
)
2 Likes

Hi Steve,
Works great! Thanks

2 Likes