5 Replies Latest reply: Apr 4, 2017 1:44 PM by Apolo Takeshi Batista RSS

    Same Date Comparison CY (Current Year) x Last Year (LY)

    Apolo Takeshi Batista

      Hi there,

      I got the following issue:

       

      Variable

      vDateLY

      =date(if(weekday([vDateMin])

        -weekday(AddYears([vDateMin], -1))>0

        , addyears([vDateMin], -1)

        +(weekday([vDateMin])-weekday(AddYears([vDateMin], -1)))

        , addyears([vDateMin], -1)

        +(7-weekday([vDateMin])-weekday(AddYears([vDateMin], -1)))))

       

      So, when I choose this vDateMin as The date: 01/02/2017 (1st Wed of Feb)

                                         vDateMinLY = 03/02/2016 (1st Wed of Feb)

      same logic in vDateMax

      and  vDateMaxLY

       

       

      So I want to show a Graph that shows the FLOW considering CY againist LY

      (on a DAY basis, a WEEK basis and a MONTH basis)

       

      Expression: FLOW_LY =

      Sum(

        {<Year=

        ,Month=

        ,Day =

        {">=$(=Date(vDateMinLY )) <=$(=Date(vDateMaxLY ))"}

        >}  FLOW)

        =0

        ,Null()

        ,

        Sum(

        {<Year=

        ,Month=

        ,Day=

        {">=$(=Date(vDateMinLY )) <=$(=Date(vDateMaxLY ))"}

        >}  FLOW))

       

      Expression: FLOW_CY =

      Sum(

        {<Year=

        ,Month=

        ,Day =

        {">=$(=Date(vDateMin )) <=$(=Date(vDateMax))"}

        >}  FLOW)

        =0

        ,Null()

        ,

        Sum(

        {<Year=

        ,Month=

        ,Day=

        {">=$(=Date(vDateMin )) <=$(=Date(vDateMax))"}

        >}  FLOW))

       

      OK, this part is working.

       

      Now i Need to DISPLAY data.

       

      What should I use as dimension?

       

      I used this as Dimension:

      =

      If(

        (Day>= '$(vDateMin )' and Day<= '$(vDateMax)')

        or

        (Day>= '$(vDateMinLY )' and Dia <= '$(vDateMaxLY )'),

        if(vClick_Label_Day='day',

        mid(Date(Day),1,5),

        if(vClick_Label_Week='week',

       

        Week,

        Month

        )

        )

      )

       

      The problem:

      The day 03/02/2016 will be shown with 03/02/2017, so this is not fully working...

       

      Thx in advance!!

       

      But i think that it is almost it, I just need to figure out how to exhibit the dimension better!