3 Replies Latest reply: Feb 26, 2018 5:30 PM by Digvijay Singh RSS

    Switch 2018 with an expression

    Marios Mylonas


      I have an issue which I cannot solve.

      I have written the following code: Sum({$<start.autoCalendar.Year={2018}>}total_price). What I want is the total price for only 2018.

      It actually works. However, I would like to replace 2018 with an expression which will be updating according to current year. In that way, when 2019 comes, this will become automatically 2019. I have tried to replace the 2018 with the following: year(today()), but I get no results. Do you have any recommendation?

        • Re: Switch 2018 with an expression
          Digvijay Singh

          Try this -



          • Re: Switch 2018 with an expression
            Marios Mylonas

            Thank you very much for your prompt reply. It does work indeed. May I ask another thing in case it is possible for you to answer. I would like to calculate the sales that I have had exactly a year ago for my previous year. So if I looked back at 26/02/2017, what is the amount of sales for 2017 that I would have seen?


            The only way I have found out to do so is:



            I guess that there should be a better way that just typing 12 month ago, 13 months ago  etc.

            Is there any more general function for that?


            Thank you in advance

              • Re: Switch 2018 with an expression
                Digvijay Singh

                Try this along with ‘year-1’expression-

                Month = {$(=Month(today()))}


                I didnt understand ur monthago condition.

                In most of the cases date related functions help to identify the right

                period, check addmonth function as well, its very useful to add/ subtract

                months. Also monthstart function to check thing from start of the month.

                Qlik help has good explanation about these.

                Let me in case I can help u further if You are stuck somewhere. Thanks


                On Mon, Feb 26, 2018 at 3:20 PM Omodos Houses <qcwebmaster@qlikview.com>