1. Currently a formula in Tableau can look plain and a bit boring:
    I would suggest highlighting the syntax words like Case, When, Then, End etc. The result should look like this:
    I would also add that we could highlight the quotes so that it becomes:

    When 'California' Then 'CA'

    Talking about visualization ... This will visualize the difference between user-input texts and Tableau-defined syntactic words. It will make formulae a lot easier to read and to debug.

    Already submitted the idea as a feature request. If you like the idea, please upvote it! The more votes, the sooner it will be implemented.
    0

    Add a comment

  2. This Monday's Viz of the Day (8/22/2016) is about malaria in Africa. This topic is dear to me in two ways:

    - Last year in 2015, the Nobel Prize in Medicine was given to Ms.Youyou Tu of China for discovering artemisinin and dihydroartemisinin, used to treat malaria, which saved millions of lives. She got her inspirations from Chinese medicine. Being a native of China, I am very proud of her. Here is her Wikipedia article.

    - Recently Tableau Foundation launched a project for helping Africa combatting malaria. I have joined the project and helped mapping some of the African villages. Also, I introduced a few kids to volunteer for the project.

    The viz in question is simple and elegant. It has got all of the 47 countries in Africa on the map. But if anyone can find them all on the map, I would be very surprised. The problem, as Zen Master Andy Kriebel once pointed out, is that the countries are of irregular shapes and sizes on the map. The smaller countries are at a disadvantage because users are less likely to see them or to find them at all.
    The tweak here is to add a dot to each country, big or small. So tiny countries like Comoros, Swaziland, Gambia and Cabo Verde are surfaced. People can easily point and click them to view stats. The original viz's layout and tone remain unchanged.

    The dots are added through dual axis. Click image to go to the interactive version. The data is updated to 2000-2018 based on WHO report.

    BTW, this viz is part of the #MakeoverMonday project.
    9

    View comments

  3. I wrote previously a post on how to count customers who bought both A and B. Today someone asked how to count those who all bought the same N items. N>=2. He specifically requires a multiple choice filter so that people can select some items and only those who bought them all are showing. (All right, the problem is paraphrased.)

    In the previous post, the purpose is to map out the tallies for all possible pairs of products and to study the correlation between products. Here we only need to show the customers who bought one set of products.

    We will use the Superstore data set as an example. In the data set, there are 17 subcategories. We will show how to list or count the customers who bought the same set of subcategories of products.

    The main steps are as follows:
    1.Right click the Sub Category filter and make it a context filter.
    Only those who bought any one of the sub categories are kept using this filter.
    2.Show Sub Category filter and select only 2 of the sub categories. (You can select more after step 4.)
    3.Apply the following filter:
    This filter will only keep those who bought exactly the same set of selected subcategories.

    4.Select True when prompted. If you don't see True, do these:
    - Show filter
    - Click the drop down menu of the filter
    - Select "All values in context"
    Caveat: don't select too many subcategories in the same time. Otherwise, you might see a blank screen because no one bought all sub categories of products. Start by selecting any 2 sub categories.

    Last, this LOD formula will give us the number of total customers who bought the same products.
    You can play with and download the interactive workbook here.

    8

    View comments

  4. A viz is a piece of application software that has data as input and graphics as output. In between we created a flow of logic. We may have all experienced buggy software in our life. It is part of the human nature that we have imperfections which are reflected in our creations. So it's necessary to debug our viz as part of a creative process. Tableau is not only a software creation tool, but also a terrific visual debugging tool. We can use Tableau to make sure our data and logic are correct.

    Usually, I like to sort dimensions first to have a simple and straight preview of the data. This served me recently.

    A Viz in a tweet intrigued me last week. It's about the tally of various colors that Van Gogh used in a painting: the famous Starry Night. The viz author Adam E McCann has taken pain in converting all the pixels into RGB values.

    So I downloaded the workbook to have a look and would like to see how it is done. Here are a few things I learnt:
    - Color names and their respective values in RGB color space.
    - Nested use of IIF(). Much more concise than the "If ... then..." statement.

    By sorting the color dimension by the percentage, I got all the significant colors that are used in the painting. However when I click on the Red which is supposed to be 5% of pixels, only a few red spots are lighting up. Visually I saw it is much less than 5%. I feel something is wrong.
    A further dig revealed that the data set contained 2 paintings. The color stats are based on both. I told Adam who then fixed it. The viz went on to win the Viz of the Day on 8/12/2016! Usually I try to check out and tweak vizzes after I got them in the mail of the Viz of the Day. This one is the other way around.

    Note that my preference is to sort the colors by quantity while Adam chose to sort by spectrum, so that he can compare the colors across different paintings.

    In my workbook above (click to view the interactive version), if you select the painting filter to be All, you will see a superposed rendering of two paintings (See image below, a bit surreal!). The red color got 5% in it. In the Starry Night painting, I just didn't see that much red at all. As we create a viz, the viz itself can sometimes tell us whether it's correct or not. The sorting can help quite a bit!

    I don't know how many times I used Tableau to validate data or dedupe or bug tracing. To me, it is not only a visualization tool, but also a data validation tool.
    0

    Add a comment

  5. From a thread in Linkedin's Tableau group and the included blog and viz, I found that people may not know how to correctly embed a Tableau Public viz in a web page. There are a few blog posts on embedding. But the Tableau Public has evolved and some new features are not covered. So here is my post.

    Tableau Public may mean a couple of things:
    - A free desktop software for visual data analysis.
    - A website for hosting Tableau Public vizzes (dashboards/charts/storyboards).

    Here we are going to summarize a number of ways by which one can embed a Tableau Public viz in a web page.

    1.Pop-up

    This is my favorite way to embed a viz.

    For example, click this link. You will see a viz popping up. Close the viz, and you see this post again.

    How to embed a Tableau Public viz like that?
    - Go to the viz's Tableau Public page. Copy link by clicking the share button.
    Use that URL link anywhere in your web page, such as hyperlinking some text or an image.

    Then go the viz's home page and edit its details. Fill the URL link of your web page, as the Permalink of the viz. And save the change! Then you are done.
    2.Embed code

    In blogger.com/blogpost.com editor, turn on the HTML mode. Copy the embed code and paste it into your html source. Place it carefully where you intend it to be.

    There are two options for getting the embed code.

    Option 1
    Go to and viz and you see the embed code by clicking the share button. The code is a bit long and messy. But you don't need to care about it.
    Here is a glance of the embed code for your curiosity.

    Option 2
    You can insert this cleaner code into the html source. Note that the URL is from the share button. The height and width are from your Tableau dashboard canvas.

    <iframe 
    frameborder="0" 
    height="400" 
    width="575" 
    scrolling="no" src="https://public.tableau.com/views/Tableau10TorchRelay_Embed/Tab10TorchRelay?:embed=yes">
    </iframe>

    Check out this for embed in Weebly and this for Wordpress. You may notice that the share button and the embed code format changed in the latest version of Tableau Public.

    3.Hiding Buttons using Parameters

    There are a few parameters in the Tableau Public URL you can use to control the appearance of the viz. I don't know all of them. But this one could be very useful if you want to hide the extra control buttons of the viz, such as download, share etc. Just attach "&:showVizHome=no" to the previous URL.

    <iframe 
    frameborder="0" 
    height="400" 
    width="575" 
    scrolling="no" src="https://public.tableau.com/views/Tableau10TorchRelay_Embed/Tab10TorchRelay?:embed=yes&:showVizHome=no">
    </iframe>

    Here is the result where the lower part is hidden.
    That's it!
    10

    View comments

  6. This may be obvious to others, but not to me. Only up to recently, I had to
    - Click Add a New Data Source
    - Refill server address, port number, database name, username, password
    so that I can connect to a data source that I already have. Tableau never offers the option of saving those details, obviously for the sake of security.
    What a hassle! And we don't have to.

    Here are the steps to clone a connection:
    - Right click a data source and select Duplicate
    - Right click the new copy and select Edit Data Source
    - In the Edit Data Source window, select a different table and rename the connection
    Voila! This works with all databases, flat files, and web connectors, Google Analytics ... that Tableau offers in adding a new data source.

    Hope this saves you a few minutes and a few memory cells, if you didn't know this before.
    0

    Add a comment

  7. What is Likert scale? Here is the explanation.
    Here is the wiki page on Likert Scale. Tableau Zen Master Steve Wexler is an expert on Likert scale visualization.

    Today's Viz of the Day (8/10/2016) includes some survey data. It results from a simple yes-or-no Likert scale survey. The numbers are put in tooltips.
    With a little tweak, we can visualize the Likert scale in stacked bars right inside the tooltips.
    The method is explained in the lower part of this KB article. This still applies when there are more than just yes-or-no questions. You might have seen the KB article before. I wrote about it in another article on bar chart in tooltips. This is just another variation.

    Click the above image to view the interactive version. Enjoy Tableau!

    PS. If you got a viz for me to tweak, leave a message and a link in the comments.
    0

    Add a comment

  8. Tableau's default labeling of Pie chart is outside of the pie. But some may prefer to put the labels inside, which is not obvious.

    There are 3 ways to do it, depends on what you need.

    1.Static labeling

    If you only want a screenshot or for presentation only, just drag the labels to where ever inside the pie chart. You can use this technique. Once the data change, the positions of the labels will change. So this won't work for dynamic data.

    2.Labeling in the center

    The method is to create two pie charts: one big and one small. Put the label in the center of the small one. Then lay the small it on top of the big one through dual axis. This kind of chart is called donut chart, such as this and this and this.
    3.Labeling on the pie slices

    Similar to the previous one, here are the major steps:
    - Create a calculated field Zero which has value 0. Use it in Columns as discrete blue pill and twice in Rows as continuous green pill.
    - Create one big and one small pie charts with the same dimensions and colors.
    - Label the small one.
    - Then lay the small one on top of the big one vis Dual Axis.
    - Adjust the sizes of  pies so that labels are inside the big pie.
    - Format the chart to remove the zero line.
    Here are the views before and after dual axis.
    4.Label inside donut chart
    This is a variation of the 3rd. Just assign the same color to all slices, by using a duplicate dimension for coloring. We got this chart.
    Voila! Click the above images to view the interactive version.
    4

    View comments

  9. Sorting data is always a must for presenting information. Data in disorder is of little value. Especially for data analysts, part of our added value is to put data in order.

    Sort by what? In what order?

    There are various dimensions to order by. Among them all, the most important sorting is Sort by quantity in descending order.

    This is the most preferred sorting order in any case, if no specific direction is given.

    The Viz of the Day on baby names on 8/4/2016 is a great visual analysis on the trend of baby names. I especially like:
    1.The diversity trend chart using distinct count of baby names.
    2.The correlation or causality study between mediatic events and baby naming.

    The tweaks I would do are:

    1. In the lower part of the 3rd slide, I would sort the bars by the # of years descendingly, instead of by the alphabetic order of the names.
    After sorting by the # of years:
    This way we see easily which names are the most popular.

    2.Each bar is built by stacking up a number of data marks over the years. The latest years are on the left. I would sort the years from left to right in an ascending order, which is the convention.

    A little sort can make a big difference, much more effective than lots of bells and whistles. Always sort your data. That's what I would emphasize today.
    0

    Add a comment

  10. There came a question regarding "Lookup via Association". I have seen similar questions a while ago. I almost forgot how I solved them before. This time I will write it down.

    Problem Statement

    Given a customer who is from some state(s). We would like to see all the other customers from the same state(s). (Plural because the customer may have been migrating from one state to another along the years.) This customer and the other customers are associated by state(s). Through this association, we want to look up who else are from the same state(s).

    There are two approaches to solve the problem. The first needs to duplicate the data source. It is easy to understand. The second is based on a single data source and needs table calculations. We will use the superstore data set in the examples.

    1. Duplicate Source Approach

    We duplicate the data source so that we can perform a subquery on one to get the State(s), then perform the main query on the other data source using the State(s).

    The main steps are
    - Create a Customer Name parameter with all the Customer Name list.
    - In the Superstore Copy data set, create a field Show State
    - Create a Data>Relationships between Show State in Superstore Copy and State field in Superstore.
    - Use Superstore data set as the primary source to blend with Superstore Copy as the secondary by the above relationship.
    - Place Show State in the filter shelf and exclude the Nulls.

    This will list all the other customers in the same states as those of the selected customer.

    On a separate sheet, we can use a simple filter Match ParaName to show the list of states the selected customer is from:
    [Customer Name]=[Parameters].[Customer Name]
    This will get the job done. Here is the workbook.

    2. One-Source Approach

    Some may prefer a single data source. This approach will take advantage of the power of table calculations. A simple table calc will suffice.

    2.1 Get the list of states for the selected customer

    Use exactly the same filter as in the duplicate source approach to list the states of the selected customer.

    2.2 Show all the associated customers

    Let's create a new field SelectState:

    Then create the following sheet. Set the table calc of SelectState to compute using Customer Name. Exclude the Nulls in the SelectState field. We will get what we need.
    The resulting list of associated customers are as follows:
    Click the image to see the interactive version.

    3.Adding more fields
    If we need to add more fields to the table, set them to be attributes (right click & select ATTR()) instead of dimensions. The table calcs are sensitive to dimensions. The added dimensions might mess up the table calculations.

    4.Postscript
    That's how we can use table calcs to filter the entire table, or use data from a single row to filter other rows. To learn more about table calcs, just google "Tableau Table Calculations".

    0

    Add a comment

Blog Archive
Loading
Dynamic Views theme. Powered by Blogger. Report Abuse.