4 Replies Latest reply: Jul 1, 2013 4:01 AM by sarah_mader RSS

    Get Date of Max value



      i try to find the date when the max value occures.


      Example table:



      First i have to say my table is animated.

      Means i use Max({<Date={'<=$(currentDate)'}>}Price) in Expression.


      currentDate is a variable, with changes every second.


      Now i want to find the linked date, when the max Price occurres.


      I tried:





      but it's not working...

      Any ideas?



        • Re: Get Date of Max value
          Deepak Vadithala

          Hi Sarah,


          Have you tried using FirstSortedValue()? This will fetch the Date for the Max Price value.


          Firstsortedvalue(DISTINCT Value, Date)



          I've created video tutorial on my blog. Please check this link...




          I hope this helps! BTW - I'd recommend using animated/Now() functions in the dashboard. It might work okay but there will be constant CPU overhead. I'm sure you're aware of this.


          Good luck!





            • Re: Get Date of Max value

              Thx for the reply!


              Yes,  FirstSortedValue(distinct Date, -Price) solves the problem.

              Very nice and compact function!


              Also some very informative movies:)


              I'm happy that u understand how to animate with now()-function, so i have to use this chance to ask some questions about the experience with "self-animated" charts^^

              What do u mean with constant CPU overhead?

              I know that the animation needs more CPU than normal charts, but not in an damaging amount...

              Do u think, that animating with the now()-function should be avoided?

              Or is it a question of performance?

                • Re: Get Date of Max value
                  Deepak Vadithala

                  Hi Sarah,


                  I'm glad you solved it by using FirstSortedValue() function. It's one my favourite function in QlikView.


                  I did some animations using Now() to show stock live in a store. I.e showing/hiding images based on time and using source data of current available stock. It works fine but if you have massive application with loads of calculations then it will bring down the peformance & user experience. As you understand that QlikView caches all the calculations until Working Set Limits are reached. So performing calculations every second may not be a good idea if you have complex calculations or variables.


                  It's not recommended but it doesn't matter if it's simple application and if it's already working fine. Probably you should come up with mathematical approach of calculating once every few minute instead of every second.


                  Good luck!