Tuesday, January 14, 2014

If you can't learn it after six times...




My mother (not shown above) once said, "Michael, if you can't learn it after six times, you're never going to learn it." She only used "Michael" when I was in trouble, so I actually learned this advice after hearing it only four times. Then my dad said, "Pick up the dog poop before you mow the lawn." Implied was the fact that it was time to mow the lawn. It only took me two times to learn that.

I haven't actually taken the time to count, but I think this is the sixth time I've taught you this:
QlikView is basically a fancy aggregation tool. 
In plain English, that means that QlikView takes some data, aggregates it (e.g. sum or count), then splits it up over a dimension (e.g. Quarter). If we aggregate (sum) sales over time (Quarter), we might get a chart that looks like:


Find and dandy. But what if you have something like advertising spend or MDF that affects sales? Generally, marketing activities affect sales that are not in the same time period, which means that you might want to compare MDF from FY12Q3 to sales from FY13Q1.


It's difficult to visualize the impact because your eyes have to focus on different groups of bars. It would be much better to look at FY13Q1 without also having to look at FY12Q2.

Since you guys are smart, I know what you're thinking... just use some set analysis to 'adjust' the time frame for the MDF. So you use an expression like:
Sum({<TimeFrame = {'Current Quarter - 2'}>} MDF)
Pleased with yourself, you hit OK. Cuss words flow as you notice that the MDF bars are gone from your chart:


The reason is that set anlaysis is evaluated once per chart, not per row. (In this case, the Quarters serve as the rows.) You've confused QlikView by saying 2 quarters ago. QlikView thinks, '2 quarters ago from what? There are 9 starting points! I'm not doing it.'

The solution comes from our old friends, ValueList and variables. And a visualization redesign.

Step One - Redesign

A grouped bar chart is not the best choice for this analysis. Sales will be orders of magnitude larger than the MDF spend, which means that any variation will be hidden in the relative sizes of the bars. A stacked bar suffers from the same problem. Since I occasionally give credit where it's due, the solution to this problem comes from Analyst Extraordinaire, David Stuart.


The interesting metric for this chart is the proportion of MDF to Sales. Instead of seeing a bunch of grouped bars, we'll present a line chart. Line charts are best used to see data trending over time, which is perfect for this analysis.


Much easier to see the ups and downs. One weakness is that the higher points in the chart mean worse performance. It took more MDF to achieve sales. This is a reminder that you may need to work with your clients to help them understand their data/results.

Step Two - ValueList

There are a couple of ways to create your ValueList. The first is to simply list the quarters you'd like to show:
ValueList('FY12Q1', 'FY12Q2', 'FY12Q3', ...)
But that's static and boring, and we do neither. A better way is to nest the variables.

Step Two A - Better ValueList
Decide how many quarters your clients would like to see in the chart. This example will show eight quarters.
  • Create eight variables - vQtr1 through vQtr8 with Definition expressions that use relative dates:
Only({1<RelativeFiscalQuarter = {'Current Quarter - 1'}>} FiscalQuarterName)
  • Create a ValueList variable (vAxis) nesting the quarter variables:
ValueList('$(=$(vQtr8))', '$(=$(vQtr7))', '$(=$(vQtr6))', '$(=$(vQtr5))', '$(=$(vQtr4))', '$(=$(vQtr3))', '$(=$(vQtr2))', '$(=$(vQtr1))')
Step Three - Offset Variable
Create a variable named vOffset. It will be used to let the end user decide the offset time between the MDF spend and the sales results. So, if the end user selects '2', the MDF spend will trail the sales by two quarters.

Create an input box for the vOffset variable.
  • Select Predefined Values Only; uncheck Enable Edit Expression Dialog
  • Check Number Series from 0 to 6, with  step of 1
  • Select Predefined Values in Drop-down



Step Four - Calculated Dimension

Create a Calculated Dimension using $-sign expansion and your ValueList variable:
=$(vAxis)
Step Five - The Expression

This gets a little messy, but it's the magic that makes the technique work. Instead of evaluating the set analysis once for the chart, it treats each row (or cell, if you have multiple columns) as an individual chart. We've been through creating ValueList expressions before (here, here, here), so I won't go through the entire process, but here are the highlights for this solution.

  • Your 'If' statement has a variable looking  at a variable. Make sure to put them in the order that you want the chart sorted by:
If($(vAxis) = $(vQtr8),
  • The calculation for the point on the line is MDF / Sales. 
Sum({<RelativeFiscalQuarter = {'Current Quarter - $(=$(=(8 + vOffset)))'}>} MDF)
/
Sum({<RelativeFiscalQuarter = {'Current Quarter - 8'}>} Sales)
  • The messiness on the numerator is a double $-sign expansion. It replaces the '8' in 'Current Quarter - 8' with the sum of 8 and the offset time set in vOffset.  
  • Repeat for the other seven quarters.

The Result

The result is an interactive chart that your users can manipulate. They will be able to see how long it takes their MDF efforts to affect sales. Who am I kidding? The result is that you built something bitchin'!!!


Tuesday, January 7, 2014

Help me Rhonda

There were a lot of good things about the '80s. Apple Macintosh. Yugo. Fall of the Berlin Wall. Cyndi Lauper. Die Hard. My Gold Medal at the 1980 Summer Olympics. Ronald Reagan. Brits kickin' it in the Falklands Islands. DeLorean DMC-12. MTV. Pac-Man.

Unfortunately, the Beach Boys concert at Park West in 1982 was not one of them.


Help me Rhonda! I spent 12 bucks to see a virtual Bear Country Jamboree? There's no way those dudes were still alive! Animatronics DO NOT ROCK! Van Halen ROCKS! But don't get me started on Van Hagar...

Which brings me to the simple fact that I learn new QlikView things because people come to me for help. The latest was a request to only show the top 50 partners (in sales) no matter what filters were selected. On its face it's a reasonable and simple request. As a sales manager, I really don't care about the ankle-biters. I only want to see the Partners that make a difference.

Then I started to ponder the details.

Monday, December 2, 2013

Fightin' the Good Fight... On Pies.



Pies make great weapons. Delicious, nutritious weapons. They make stupid charts. Evil, lame, boring charts. And we all know that pie charts kill kittens.




So, in the words of Nancy Reagan, "Just Say No". Unless you're in Colorado or Washington. Then just say, "Dave's not here, man". Take some time, put a little thought into it, and you can come up with a much better illustration of your data.


Thursday, November 21, 2013

Good vs Evil (or "How to confuse with a poor bar chart")

There's good and there's bad. And then there's BAD:


And since the Muscles from Brussels knows no bounds, he played both good and bad in his Oscar-worthy masterpiece, Double Impact.



And since we sometimes refuse to channel our inner van Damme, we create bad bar charts:


We've all done it. Sales by Year by Month. Lots of colors. Lots of data. Almost no insight. This is your Double Team where you make Dennis Rodman look like a real actor. We can fix it, just like they fixed Jean-Claude in Universal Soldier.


Wednesday, November 13, 2013

The Magic of the Princess Bride

One of the greatest things about being a dad is making your son -- who was brought up on a steady diet of Call of Duty, John McClane, Dutch, and "did you check to see if it's loaded?!?!" -- watch The Princess Bride.


The transformation from "ha ha dad that's funny" to "horrified" to "pleading 'no don't make me do this!'" to "you're not my dad, what did you do with my dad!?!?" to "resignation" to "this is funny!" is almost too much to bear.

And now I bear the responsibility of sharing some QlikView awesomeness with all of you...


Thursday, October 10, 2013

Hey FontFace!

It's 1977. I'm fourteen. At a church dance. With girls.



They've played Dream On by Aerosmith (oddly appropriate) and I was too scared to move. Frampton Shows Me The Way, but who to ask? Then it happened. Zeppelin's Stairway to Heaven spins up and a girl asks me to dance! An older girl. To a slow song. 14 year old nirvana! Then, disaster! The darn song speeds up in the middle and we have to let go and fast dance! What do I do with my arms? And my legs? Oh my gosh, my legs!



And now you know how I feel when you use a mishmash of fonts. Confused. Just pick one and use it.

Scenario: One Bar Chart, One Tab


Question: How many places can you change the font?

Answer: Only counting the buttons that say 'Font', I count ELEVEN! Even more if you consider things like Expression Attributes.

Result: A plethora of ways to crap-up* your interface on even the simplest dashboard.

Let's go through them one by one.

Friday, September 20, 2013

Dollars or Units?

Yesterday was 'Talk Like a Pirate Day'. I didn't post this yesterday because I was going to try out some sweet pirate pick up lines on my wife and didn't want to spoil her amazement at my smoothness...


Which means that I risked a mutiny because you had to wait a day for the bounty of my treasure of knowledge.

Just like a good pirate can choose the best weapon - Cutlass or Blunderbuss - you need to give your user a choice between the best information to run their business. Today, we'll learn how to give them the option of seeing their sales in either dollars or units all in the same chart.


Luckily, this even easy enough for an analyst with a grog hangover.