Thursday, July 30, 2015

Flow Chart / Flow Diagram / Decision Tree in Tableau

There are two ways to go about building a flow chart/diagram or decision tree in Tableau.  You can either treat it as a scatterplot on a single worksheet, or you can think about using a dashboard as your canvas, and then float multiple worksheets on the dashboard to achieve the right shape/flow.

I first started exploring the former.  It is a similar technique to using background images in tableau and creating a lookup table for the x,y coordinates of the marks you want to plot on top of the image.  I quickly noticed two downsides with this:  1. You need to add more data in the form of a new table of x,y coordinates to your underlying data (to be joined or blended to your actual data) - there are obvious downsides to this; 2. You cannot use actions to trigger a drilldown to another worksheet by clicking on one of the numbers/marks in your flow chart (since all the marks are in one chart you cannot create a different filter action per mark (metric) in your chart - i.e. if I clicked on a metric I would want to be taken to another worksheet that has more details about that metric, and if I clicked a different metric I would want to be taken to a different sheet).

That's why I decided to try using the dashboard as my canvas and then make a separate worksheet for each metric, which could then be floated/arranged on the dashboard canvas.  Benefits of doing it this way:  1. You do not need to alter your data at all!; 2. You can create a separate filter action for each metric/worksheet that goes to a different destination worksheet in order to drill down and present more information about that metric.

That approach allowed much more flexibility in terms of how to arrange each mark in the flow chart, but one question remained:  How to get the arrows into the chart?  My first thought was to insert images of arrows into the dashboard.  If you are good with editing images and rotating them and sizing them to then be inserted into the chart then this is a viable approach.  However in my example I wasn't quite sure about how far each mark needed to be from one another and what angle each arrow needed to be at etc.  Since you cannot rotate images in a tableau dashboard you would need to create an image with arrow at exactly the right angle, which is a pain.  Perhaps if you only need straight arrows or already have a bunch of these images laying around then this might not be very painful.

Instead of images, I decided to use another worksheet to be the background or first layer of canvas which I could then add point annotations to to create my arrows.  A little formatting is necessary after you add the annotation (need to remove all the text, then format it to get rid of any borders and change the thickness and color to suit your needs) but they worked quite well.  The only trouble I had with this was even tough there was no text in my annotation, I needed to make the 'text box' quite wide so that once I floated a worksheet with one of the metrics over the top of it that I could still select the text box in order to move it around to get the start of the arrow to be in the right place.

Quick order of how to build this:
1. Build all the worksheets - one metric per worksheet
2. Build one more worksheet for the 'arrows'.  In order to add annotations there needs to be something in the view, so I just added number of records to text, changed transparency to make it clear (via Color shelf), removed the tooltip, and set the fit to 'Entire View'.  Dont add the annotations yet.
3. Create the dashboard: Add the Arrow worksheet first, then 'float' each of the other metrics and arrange them how you want.
4. Add the annotations to create the arrows from the dashboard itself.  I used Point Annotations.
5. Move them around and format them to your liking.

In addition to being a good example of this specific chart type, there are lots of nifty Level Of Detail (LOD) expressions used to calculate each of the metrics.  Things like 'Spend Per Customer', 'Avg Visit Value', 'Items Per Visit' and so on.  Since the granularity of the underlying data is at a per order per line item level, getting these type of metrics would require lots of sub-queries with multiple levels of aggregation to achieve before the LOD expressions were introduced in 9.0.  LOD's rule.

Two workbook's are available for download - one with just the flow chart and one with some filter actions to allow you to drill down to other detailed worksheets (I got lazy and only set up drilldowns for the first 3 metrics, but you will get the point).

Flow Chart: https://app.box.com/s/v06fqkxiufhwpyfhc3h3fba3rk83soqo
Flow Chart with Drill: https://app.box.com/s/mkf3ka80j8hy2cvtqxybo6rvk1918ruq

Any questions or improvements you've found, please comment below.

-The Don

13 comments:

  1. I have read your blog and I gathered some needful information from your blog. Keep update your blog. Awaiting for your next update.


    Tableau Online Training|
    SAS Online Training |
    R Programming Online Training|

    ReplyDelete
    Replies
    1. I was searching for loan to sort out my bills& debts, then i saw comments about Blank ATM Credit Card that can be hacked to withdraw money from any ATM machines around you . I doubted thus but decided to give it a try by contacting { cyberhackingcompany@gmail.com} they responded with their guidelines on how the card works. I was assured that the card can withdraw $5,000 instant per day & was credited with$50,000,000.00 so i requested for one & paid the delivery fee to obtain the card, after 24 hours later, i was shock to see the UPS agent in my resident with a parcel{card} i signed and went back inside and confirmed the card work's after the agent left. This is no doubts because i have the card & has made used of the card. This hackers are USA based hackers set out to help people with financial freedom!! Contact these email if you wants to get rich with this Via: cyberhackingcompany@gmail.com ..    

      Delete
    2. iI’m lauriel from New York, United States. I lost my job a few months back after my divorce with my wife. I tried everything positive to make sure I took good care of my kids but all failed, and I was in debt which makes everything worse. I was kicked out of my home and i had to live with my neighbor after pleading with her to allow me to stay with her for some days while I figured out how to get a home which she agreed to, but no one was willing to help anymore. I bumped into this page from google and I was excited about this, then I contacted the hackersBill Dean. I had just $200, so I pleaded with them to help me because of my condition but they never accepted. I believed in this, so I managed to pawn a few things and got $500. I ordered the $10,000 card and I got my card delivered to me by Ups 4 days later. I never believed my eyes! I was excited and upset as well, I managed to withdraw $2000 on the ATM and $2500 the second day. I went to Walmart and a grocery store and bought a couple of things for $3000. The card got blocked the third day and I contacted them and I was told it's a mistake from my end. I’m so happy, I have started all over again and have a good apartment with my kids you can contact him through is via email (globalatmcardhackingservice@gmail.com)or his whatsap contact (+1 301-887-5071)

      Delete
  2. These flow diagrams can be made with a online diagramming solution like Creately flowchart maker It's easy to create mind blowing flowchart diagrams in a little amount of time.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. I think this is actually very quick but informative explanation to Tableau anyways.

    Tableau Rest Api Connection

    ReplyDelete
  5. Would you make this available on tableau public?

    ReplyDelete
  6. Good Post!, it was so good to read and useful to improve my knowledge as an updated one, keep blogging. After seeing your article I want to say that also a well-written article with some very good information which is very useful for the readers....thanks for sharing it and do share more posts like this.
    Selenium Online Training

    ReplyDelete
  7. Good Post! it was so good to read and useful to improve my knowledge as an updated one, keep blogging. After seeing your article, I want to say that also a well-written article with some very good information which is very useful for the AWS Cloud Practitioner Online Training

    ReplyDelete
  8. I was searching for a loan to sort out my bills & debts, then I saw comments about Blank ATM Credit Cards that can be hacked to withdraw money from any ATM machines around you . I doubted this but decided to give it a try by contacting { officialblankatmservice@gmail.com} they responded with their guidelines on how the card works. I was assured that the card can withdraw $5,000 instant per day & was credited with $50,000,000.00 so i requested for one & paid the delivery fee to obtain the card, after 24 hours later, i was shock to see the UPS agent in my resident with a parcel {card} i signed and went back inside to pick up my car key and drove to a nearest ATM machine to confirmed if the card really work to my greatest surprise it did.. This is no doubt because I have the card & have made use of the card. These hackers are UK based hackers set out to help people with financial freedom!! Contact them via email: officialblankatmservice@gmail.com or WhatsApp +447937001817 if you want to get rich.

    ReplyDelete
  9. good article, very useful... thanks for sharing

    ReplyDelete
  10. Do your arrows disappear/appear if a node doesn't exist or are they static?

    ReplyDelete