Author's Note: This is an interesting technique but I believe a simpler and more general purpose method is in a blog post from Aug 2016. Search on "QlikView Maven Is My KPI Getting Worse or Getting Better"
I did a weekend project several weeks ago where I was working with a database containing some business measurements taken each day over a long stretch of time. I wanted an easy way to visualize whether the aggregate measurements were getting better or worse over time. In order to satisfy the “easy” part of that objective, I decided to build expressions that would automatically split the available measurement dates into two groups: the earliest half of the dates and the latest half of the dates. That would allow me to create charts with a heat map feature that easily identifies areas for further investigation.
I made a
simplifying assumption that I would always have a contiguous span of dates. So,
calculating the median date would give me the middle date that splits the group
of dates into the two half groups that I need. Using set analysis syntax to
make the sum function operate over the early half of the dates looks like this:
Sum({<MDate={'<=$(=Date(median(MDate)))'}>} sorg_delta)
But, I can’t
do something a simple as that for the other half of the dates because I may be
working with an odd number of days and any comparison of the data must be done
for the same number of measurements otherwise it would affect a comparison of
the aggregate business measurement between the two groups. So, the other half
of the expression that includes the later half of the dates looks like this:
Sum({<MDate={'>$(=Date(median(MDate)+if(odd(count(distinct MDate)),1,0)))'}>} sorg_delta)★★★
No comments:
Post a Comment