Thursday 13 June 2013

Qlikview Chart kept flashing and going back to top of scroll - use of Now() function

I have a chart which worked okay, except for it kept flashing and whenever scrolled down to see more values, it jumped back to the top.  Couldn't work out why.  The data model it uses is a bit messy with fields from three different tables getting mixed together, plus set analysis and other calculations.

Did several changes, including to data model, but still couldn't resolve, until checked out something.

The chart lists customers won in last few months.  By default the document has selected month being only the last month, so the chart uses set analysis to extend.  It uses a variable to determine the start month which originally was MonthStart(Min(Date_Month),-3) to get the starting date for set analysis.

Then user wanted instead of last 3 months, back to start of the fin year (or possibly other customised fields).  I setup another variable to calculate how many months were needed to go back to include the start of the year.  For that variable I used Month(Now()) to work out which month we were in and work back from there.

That was the problem.  By including Now() in the variable, Qlikview constantly recalculated that variable - once every second I guess - and the set analysis calculation in the chart.  Hence the flashing and the scrolling issue.  I've replaced Now() with Today() so now will only cause a problem once a day, and only if user is up late.

Probably better methods to get the same result, but important takeaway was using Now() has risks.

No comments:

Post a Comment