3 Replies Latest reply: Jan 18, 2016 4:56 AM by David Gutiérrez Melendro RSS

    How to include and if sentence on a set analytic?

      Hello guys,

       

      After several days with the same problem, I need some help.

       

      Right now I got a couple of variables like this:

       

      vCurrentMonth = =num(Month(Today()))

      vCurrentYear = =num(Year(Today()))

      vPreviousMonth  = =num(Month(AddMonths(Date(Today()),-1)))

      vPreviousYear = =num(Year(AddYears(Date(Today()),-1)))

       

      Witch I use along the qlv. This way I can show on a table data from the actual Month and Year as follows ...

      =sum({1<month={'$(vCurrentMonth)'},year={'$(vCurrentYear)'} >} events)

      and for the previous month:

       

      =sum({1<month={'$(vPreviousMonth)'} ,year={'$(vCurrentYear)'}>} events

       

       

      This works for every case except for January, because obviously the year changes. How can I include and if sentence on the code for the previous month, with the next logic?

       

      If (month = '1') ]

             year={'$(vPreviousYear)'

      else

       

              year={'$(vCurrentYear)'

       

       

      Thanks in advance,

      Kind Regards