1 Reply Latest reply: Jan 6, 2013 5:56 AM by Gysbert Wassenaar RSS

    calculate lastmonth

      I wanna to display the sale value of lastmonth in one chart.

      but my month list are text like:

      Jan, Feb, Mar……Dec

       

      "sum({$<Month={$(=Only(Month)-1)}>} 金额)" will not be available in this situation,

      how can I calculate my lastmonth sales value?

       

      Appreciate for any comment!

        • Re: calculate lastmonth
          Gysbert Wassenaar

          If your Month field was created with the month() function from a date it will have both a text and a numeric value. So try this:

          =sum({$<Month = {">=$(=only(Month)-1)<=$(=only(Month)-1)"}>} 金额 )

           

          One would think that if the above works then something like Month={"=5"} would work too, but it doesn't. Yet Month={">=5<=5"} does. I hope QlikTech comes up with a saner way to deal with dual value fields in set analysis expressions soon.

           

          If your Month only has a text value, then use the dual() function to give it both a text and numeric value or create a numeric field like for example MonthNum too. Better yet, use the Qlikview Components library to generate a calendar for you with all sorts of handy fields and set expressions.