Home | About | Log in | Get The Feed
Tableau Tip Tuesday – Splitting Metrics on Dimension Values

November

10

2009

I recently came across this question on the Tableau forums. Serendipitously, I had just started doing this and had worked out the rather simple solution. Because someone other than me had raised the question, I thought it might be worth sharing here.

The Problem: Splitting a measure into discrete, sub-measures based on the values of a dimension.

The Why: Lets say you have a measure ‘Sales’ and a dimension ‘Product Type’ (this should sound familiar as its from the ‘Coffee Chain’ sample DB). Further assume that you want to do some parts-to-whole comparison which could be achieved via a table calculation but there are a couple of practical issues with that. One, the table calculation is basically a virtual object and so you can’t use it in downstream calculations and two, if you only want to display a specific dimension-value — ‘Coffee’ for instance – I can’t filter for ‘Coffee’ and still show its part-to-whole relationship correctly. By splitting the measure into discrete sub-measures we can perform operations and calculations on the data that otherwise might not be possible.

Here’s what the post on the Tableau Forum said by way of further illustration:

[H]ave a look at the attached xls file. You see that I have a column called "Indicator". I now would like to make a scatter plot with KPI_1 on the x-axis, KPI_2 on the y-axis, and using KPI_3 to size the circles.

I thus somehow need to split my dimension "Indicator" into 3 specific components for each of the KPI. Can this be done in Tableau ? Or is it mandatory to have basically one column in your data source, per dimension?

The solution is fairly simple although it may not be particularly intuitive. We’ll leverage the LOGICAL function ‘IIF’ which tests whether a condition is TRUE or FALSE and returns a specific response depending on the condition. So, using the Coffee Chain sample Access DB…

  1. Right-mouse click on ‘Product Type’ in the Dimensions shelf
  2. Select ‘Create Calculated Field…’
  3. Name the Calculated Field “Coffee Sales”
  4. In the formula pane (which should be pre-populated with [Product Type], add the following formula: IIF([Product Type = “Coffee”,[Sales],NULL)
    split-on-dimension-formula-1
  5. Click ‘OK’

You should now have a calculated measure in the Measures shelf called “Coffee Sales”. Repeat the above process for each of the other three values in the ‘Product Type’ dimension (Espresso, Herbal Tea and Tea).

Use ‘Duplicate Measure’ and ‘Edit…’ to speed up the process. All you will need to do is change the targeted Dimension value

Now that we’ve created four measures based on splitting values in the dimension of Product Type, we can create an example Scatter Plot to address the question from above.

On a blank worksheet, drag ‘Coffee Sales’ from the Measures shelf to the column shelf – make sure it is set to ‘Continuous’. Drag ‘Espresso Sales’ to the row shelf and make sure it’s set to ‘Continuous’. You should now have a scatter plot with one mark. Probably, we want more detail than a single mark – try right-mouse clicking the date dimension and dragging it to the ‘Level of Detail’ shelf and select ‘Date (Continuous)’. This ought to give you 24 marks. They probably appear to be tightly grouped with little discernable pattern wise, but let’s work with it for a moment.

image

Try putting ‘Profit’ on the size shelf. Now we get an indication of where the high profit versus low profit intersects are but the data is still highly clustered making pattern recognition difficult.

image

See? Still a jumbled mess, we’re not learning anything yet but this is exploratory analysis so it’s ok! Let’s try putting ‘Market Size’ onto the ‘Shape’ shelf.

image

Ok, so Profit isn’t really telling us anything that we couldn’t have logically concluded from ‘Major’ to ‘Small’ market differences. Let’s create a % Net Margin measure. In this case, be sure to use SUM otherwise the % Margin calculation may have unintended values. The formula should look like this: SUM([Profit]/SUM([Sales]).

image

Still not a lot to see here. What if we drag ‘State’ onto the Color shelf?

image

Now we’re getting somewhere! Adding State-level detail gives us a lot more marks to work with, but the overlapping points are still making it harder to read than is necessary. Let’s make some formatting changes to see if we can make things a little more clear. Start by increasing the transparency of the mark colors – I ended up at about 50% transparent. That definitely helps to see ‘through’ the overlapping points as well as the density of marks. Make sure that the scales on the x and y axes are the same – it’s a scatter plot afterall. I also changed the pane background to black (yes, black) and added light gridlines. In this case, I think both help make discernment easier.

image

Enable highlighting from the Color legend, then you can focus on a particular state in the visualization. Most states exhibit what most of us would be ‘normal’ patterns – either no particular relationship between Coffee and Espresso or as Sales in one grows, so does the other. A couple of outliers though are apparent though. Try selecting Ohio. In the ‘Small’ markets product sales are binary – that is, either Espresso is sold or Coffee is sold but not both. On the other hand, in the Ohio ‘Large’ markets, we revert to one of the ‘normal’ patterns. Now select ‘Massachusetts’. What? There appears to be a downward trend in Espresso sales as Coffee sales increase. This would seem to indicate a more graduated preference pressure on Product Type than we saw in Ohio. Further analysis of Massachusetts would be necessary to understand the graduated sales and if that pressure can be used to improve sales or profits.

image image

Alright, so that’s it. A tutorial on how to create dimension-value specific measures that turned somewhat into a discussion of exploring data to find interesting patterns. All that’s left is the discussion…

FILE ATTACHMENT: Split Dimension Tutorial Packaged Workbook

By: Clint | Posted in Tableau Tips | Tagged: | 3 Comments »
Creating A Pseudo Reference Line in Tableau

July

7

2009

One of the weaknesses of Tableau is that you can’t add a reference line to a chart that is based on a custom calculation or another metric within the workbook. The calcs that are offered for reference lines are good and applicable in many situations but sometimes, they are just not right. In the short video below, Joe Mako explains how to fake a custom, dynamic reference in Tableau.

Adding a sudo reference line in Tableau from Joe Mako on Vimeo.

NOTE: Joe directed me to his tutorial after I was asking some questions about reference lines on Twitter yesterday, I’m simply passing along his great little tutorial. Please enjoy!

By: Clint | Posted in Tableau, Tableau Tips | Tagged: , , | 2 Comments »

prednisone buy cod watson brand order prednisone on line Cytotec shipped over night without a perscription buy pharmacy Orlistat waterview buy 40 mg accutane online without prescription buy Nizoral Online order generic Crestor purchase prednisone without a prescription overnight shipping generic finasteride buy 10 mg Accutane precio cytotec online cheap cytotec from mexico buy Premarin no prescriptions order Valtrex without a prescription overnight shipping Valtrex bestellen accutane in Canada purchase 10mg accutane 40 mg overnight delivery buy synthroid mail buy order prescription free Buspar buy zithromax no scams order no prescription Flomax Orlistat on line purchase metformin free consultation how to order Xenical buy Amitriptyline without doctor Amitriptyline online order saturday delivery purchase Crestor pay pal without rx generic finpecia online finpecia usa order Crestor uk buy genuine Buspar best buy valtrex comprar Crestor generico buy cheap Zithromax order buy Zithromax online where can i purchase Buspar no rx (Metformin espana|purchase Metformin|Metformin ohne rezept|Metformin pills|what is Metformin used for|price of Metformin|best buy Metformin|Metformin preis|medikament Metformin|what does Metformin look like|buy Metformin c o d|Metformin 1000 mg|generic Metformin online|Metformin purchase|best buy Metformin|buy Metformin usa|where to buy Metformin|Metformin rezept|Metformin mexico|buy Metformin with no prescription|buy Metformin canada|where to buy Metformin|buy Metformin cheap without prescription|comprare Metformin generico|discount Metformin|buy Metformin online no rx|Metformin purchase|pharmacy Metformin|comprar Metformin generico|uk Metformin generic|Metformin toronto|pharmacy Metformin|Metformin price|cheap Metformin online|buy Metformin without prescription|buy Metformin where|Metformin online purchase|buy Metformin online|online Metformin|online Metformin purchase|uk order Metformin|how to buy Metformin without a prescription|order Metformin withou buy Zovirax no visa without rx buy no perscription Buspar Accutane overnight delivery fed ex Metformin fedex shipping Xenical cash on delivery no rx Flomax with fedex purchase Premarin cod overnight delivery generic valtrex new zealand buy no perscription Valtrex cost of valtrex buy Crestor on line buy Orlistat without rx order Zithromax without a rx overnight shipping purchase generic Metformin online buy mail order Metformin online purchase Valtrex buy Zithromax without doctor no prescription required for prednisone Premarin delivered overnight buy Premarin us buy Premarin without a rx order Premarin uk purchase Buspar without a prescription online Crestor price online Crestor order buy xenical without prescription buy prednisone online without script buy prednisone without rx needed buy Proscar offshore no prescription fedex buy Valtrex us buy Xenical shipped cod online prescription Flomax Buy xenical online with next day shipping Accutane ordering without a dr purchase Accutane no scams buy Acomplia next day delivery Valtrex best buy where to buy generic Flomax online without a prescription prednisone online overnight delivery cod buy Valtrex and Valtrex where to purchase generic finasteride online without a prescription buy generic Crestor online purchase online prescription Valacyclovir order overnight Zithromax order finasteride order amex Amitriptyline by mail Zithromax purchase Premarin without buy Proscar 5 mg generic Crestor prices Crestor precio buy cheap Orlistat on line where can i buy Orlistat online without a prescription purchase cheap online prednisone Cytotec online prescription uk Prednisone generic Buy xenical online without a prescription Valtrex no doctors consult Buy xenical online perscription uk order Nizoral achat Buspar order Prednisone usa where can i get prednisone without a prescription what is Prednisone buy Cytotec on line without a rx what is valtrex used for buy cheap Xenical under without rx buy Orlistat without a credit card order prednisone without a rx overnight shipping buy in Valtrex uk buy discount Finasteride online prednisone with no perscription overnight shipping Where to buy finasteride no perscription no fees Xenical with out a prescription order Buspar for cash on delivery buy cheapest Acomplia and Acomplia buy Prednisone without a credit card buy Prednisone cheap without prescription Proscar from canada 120 mg xenical xenical online purchase Buspar rezept order no online rx Flomax buy prednisone Valtrex usa buying Valtrex online buy Cytotec quantity where can i buy herbal Zovirax buy Valtrex in mo medikament Prednisone prednisone over the counter Xenical best buy buy Cytotec no prescription low cost Valtrex shipped cash on purchasing Maxalt online without prescription buy generic Crestor canada Rosuvastatin overnight accutane 30 mg without prescription buy Flomax amex