12 Replies Latest reply: Mar 8, 2018 10:04 AM by Eduardo DImperio RSS

    Max(Date)  with Set Analysis

    Eduardo DImperio

      Hi,

       

      I need to get the difference between consume of first and last month from each neighborhood, my problem is that some neighborhood have less months than others, but in set analysis it gets the max (date) of all neighbors and not individual,

       

       

      ex this two pictures without selection and with selection. How do i do to fix that?

       

      set_analysis.JPG

       

       

       

      set_analysis2.JPG

      I have this code:

       

      (

      (SUM({<DATA_EXTRACAO  = {"$(=DATE(MAX(DATA_EXTRACAO)))"},CONS0={">=0"},GROUP_TYPE_METER={"AGUA"}>} CONS0)-

      SUM({<DATA_EXTRACAO  = {"$(=DATE(MIN(DATA_EXTRACAO)))"},CONS0={">=0"},GROUP_TYPE_METER={"AGUA"}>} CONS0))

       

      )

      /

      If(

      SUM({<DATA_EXTRACAO  = {"$(=DATE(MAX(DATA_EXTRACAO)))"},CONS0={">=0"},GROUP_TYPE_METER={"AGUA"}>} CONS0)>0,

      SUM({<DATA_EXTRACAO  = {"$(=DATE(MAX(DATA_EXTRACAO)))"},CONS0={">=0"},GROUP_TYPE_METER={"AGUA"}>} CONS0),1

      )

       

       

      Thanks