2 Replies Latest reply: Nov 21, 2016 4:15 AM by Wilson Webb RSS

    Show values for the past months

    Weiting Yu

      Hi there,


      I'm stuck on something which seems to be quite simple... Appreciate your help with the requirements below:

      How to show values prior to the current month in bar chart? If the current month is Oct, I only want to see values for the past nine month.

       

      Thanks,

      WY

        • Re: Show values for the past months
          Tresesco B

          Solution would depend on your data, specially the date field. Try to share a sample qvw with sample data set so that we can provide you the solution accordingly.

          • Re: Show values for the past months
            Wilson Webb

            Hi There,

             

            What you are looking for is what is called a 'Point in Time Comparison'. You Achieve this through Set Analysis. Follow the below thread for understanding:

             

            https://community.qlik.com/thread/109172

             

            What you then have to do is create seven other statements in your set analysis for the pother months (as this comparison already has 2). As an example, it would be something like this:

            let v2MonthsAgo = '=month(addmonths(max(Date),-2))';

            let v3MonthsAgo = '=month(addmonths(max(Date),-3))';

            let v4MonthsAgo = '=month(addmonths(max(Date),-4))';

            let v5MonthsAgo = '=month(addmonths(max(Date),-5))';

            let v6MonthsAgo............etc.

            let v7MonthsAgo..............etc.

            let v8MonthsAgo...........etc.

            let v9MonthsAgo............etc.



            You then substitute these variables into your 'Prior Month' expression for each month.

             

            I hope this helps!