14 Replies Latest reply: Jul 18, 2018 5:16 AM by Rangam Seshadri RSS

    Set analysis for subtracting multiple date ranges.

    phuc pham

      Hi there,

      There is a date range problem for me. I have selected multiple dates in the filter panel showing a table below:

        

      Datesum(Cost)above(Date)
      02/01/20185,745.0-
      31/01/20183,829.002/01/2018
      23/02/20181,875.031/01/2018
      16/03/20182,392.023/02/2018
      28/04/20182,870.016/03/2018
      10/05/20187,734.428/04/2018
      16/05/2018657.610/05/2018
      01/06/2018531.716/05/2018
      05/07/20188,245.201/06/2018
      12/07/2018603.305/07/2018

      Im tending to create a measure to subtract Gap form the selected Date and the previous selected date (ex: Cost in 12/07 - Cost 05/07,...) and the result is for the greater date as:

         

      DateCostabove(Date)Gap
      02/01/20185,745.0--1,916.0
      31/01/20183,829.002/01/2018-1,954.0
      23/02/20181,875.031/01/2018517.0
      16/03/20182,392.023/02/2018478.0
      28/04/20182,870.016/03/20184,864.4
      10/05/20187,734.428/04/2018-7,076.8
      16/05/2018657.610/05/2018-125.9
      01/06/2018531.716/05/20187,713.5
      05/07/20188,245.201/06/2018-7,641.9
      12/07/2018603.305/07/2018-603.3

      my set analysis is

      sum({<Date=p(Date),>} Cost)

      -

      sum({<Date={"$=(above(Date))"}>} Cost)

      but it didnot work.

      Could anyone enlighten me!

      Thanks in advanced.