avatarCristian Saavedra Desmoineaux

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

4208

Abstract

eyword">THEN</span> [C] <span class="hljs-keyword">WHEN</span> <span class="hljs-string">"D"</span> <span class="hljs-keyword">THEN</span> [D] <span class="hljs-keyword">END</span></pre></div><p id="f6e1">This calculated field is going to map the measures:</p><figure id="5137"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*O7itQtcXLhei4DW166YshA.png"><figcaption><b>Measure Selected</b> calculated field—Tableau Desktop’s image by the Author.</figcaption></figure><p id="bad0">And create a new calculated field with the name <b>Highlight </b>as the following:</p><div id="0fc5"><pre>IF {FIXED <span class="hljs-selector-attr">[Measures]</span>:<span class="hljs-built_in">max</span>(<span class="hljs-selector-attr">[Measure selected]</span>)} = <span class="hljs-selector-attr">[Measure selected]</span> THEN <span class="hljs-number">0</span> ELSE <span class="hljs-number">1</span> END</pre></div><p id="2a67">I will <b>highlight </b>the bar's maximum values by dates in the Tooltip, comparing the full amount of a measure versus the current value.</p><figure id="c1b4"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*VXT01s-zLAVkMsFwo4YMGQ.png"><figcaption>Tableau Desktop’s image by the Author.</figcaption></figure><p id="af36">You will then notice when you move the <b>measures dimension, </b>the new column from the<b> densification.csv</b> file produces <b>dense </b>data in each of the <b>Measures Names.</b></p><figure id="69cd"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*twolAaTQwUebhMEp96p_ag.png"><figcaption>Measures Names vs. Measures—Tableau Desktop’s image by the Author.</figcaption></figure><p id="3f6a">Using the <b>Measure selected </b>field, you will see only the relevant value by <b>Measure </b>dimension:</p><figure id="cb8d"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*be0IKJ3B8_FAXlMDeq5GNA.png"><figcaption><b>Measure selected</b> calculated field—Tableau Desktop’s image by the Author.</figcaption></figure><p id="09b1">Because we are using <b>relationships,</b> you don’t need to worry about duplicate values when you group each of the measures separately. In older Tableau versions, you have to create an extra <b>Set</b> where choose one element of our measures list to filter the data.</p><figure id="c467"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*slZYGLKPydYPZBuW92Cdxw.png"><figcaption></figcaption></figure><p id="a306">Now you can use it as a <b>dimension </b>to pass the value to the Tooltip sheet.</p><figure id="3bb4"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*7JHDdknTw1sxPDcFOA5JqQ.png"><figcaption><b>Bars — Densified</b> sheet. Tableau Desktop’s image by the Author.</figcaption></figure><figure id="b2ef"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*JKO94SF9EXS_B3-CDTK2tA.png"><figcaption><b>Bars — Densified</b> sheet Tooltip. Tableau Desktop’s image by the Author.</figcaption></figure><figure id="95fd"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*xtNzejvB9jcZEzkFOUSoeQ.png"><figcaption><b>Tooltip — Densified</b> sheet. Tableau Desktop’s image by the Author.</figcaption></figure><p id="e04e">To produce the visualization that we were looking for:</p><figure id="781f"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*rOPK0dx5ZUk2vMCGoJulTg.png"><figcaption>Tableau Desktop’s image by the Author.</figcaption></figure><h1 id="0e94">But why doesn't work with Measure Names?</h1><figure id="bb18"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*l2Kz2tZ0yTNR8tRmA8uWWA.png"><figcaption>Tableau Desktop’s image by the Author.</figcaption></figure><p id="a1fc">The main reason is that <b>Measure Names</b> is a <b>calculated </b>field that creates a discrete list of all the measures but doesn’t exist in the dataset and, because of that, cannot be passed as a value to the sheet referred by the Tooltip at least until the version of Tableau Desktop 2020.3.1</p><figure id="0bd5"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*2wmpfh_xSCwXunvTqxyqZA.png"><figcaption><b>Bars — Non densified </b>by Measure Names in Table

Options

au Desktop. Tableau Desktop’s image by the Author.</figcaption></figure><figure id="052f"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*1N845OCYEcwIcxNM1RfIrg.png"><figcaption>The tooltip of the previous <b>Bars — Non densified </b>sheet<b> </b>referring <b>Tooltip — Non densified</b> sheet—Tableau Desktop’s image by the Author.</figcaption></figure><figure id="2abb"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*aNuRu2GI8Q2qP0GGtjFd7A.png"><figcaption><b>Tooltip — Non densified</b> sheet by Date and Measure Names in Tableau Desktop. Tableau Desktop’s image by the Author.</figcaption></figure><h1 id="20c6">Conclusions</h1><p id="22b0">We learned about <b>Data Densification</b> and how to use it in Tableau Desktop to filter values through the Tooltip when your model doesn't have a dimension representing each of the measures' names.</p><p id="6241">Also, we saw that independent of how advanced is Software that you are using, the expertise or domain that you have, you always will find a limitation, and to solve it, you need to think out of the box and be creative.</p><h1 id="5d70">Thanks</h1><p id="ebe6">To finish, I want to thank <b>Daniel Dorronsorro </b>for asking<b> </b>me about it. And <b>Rosario Gauna, </b>who push me to continue writing about these topics.</p><p id="f6ea"><a href="https://www.linkedin.com/in/cristiansaavedradesmoineaux/">Happy Viz!</a></p><h1 id="df54">Helpful resources</h1><div id="600d" class="link-block"> <a href="https://rosariogaunag.wordpress.com/2019/09/06/manifesto-of-internal-data-densification/"> <div> <div> <h2>MANIFESTO OF INTERNAL DATA DENSIFICATION</h2> <div><h3>by Rosario Gauna & Klaus Schulte Data Densification - you will have already come across this topic when you have gone…</h3></div> <div><p>rosariogaunag.wordpress.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*xydbPhTs10ej1RRG)"></div> </div> </div> </a> </div><div id="b89e" class="link-block"> <a href="https://www.thedataschool.co.uk/damiana-spadafora/data-densification-demystified/"> <div> <div> <h2>Data Densification Demystified - The Data School</h2> <div><h3>Did it ever occur to you that you created a table calculation in Tableau, and the result didn't make any sense? You…</h3></div> <div><p>www.thedataschool.co.uk</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/)"></div> </div> </div> </a> </div><div id="3839" class="link-block"> <a href="https://www.flerlagetwins.com/2019/05/intro-to-data-densification.html"> <div> <div> <h2>An Introduction to Data Densification</h2> <div><h3>Data densification is a common technique used in Tableau. Many people have written about it, including the Tableau …</h3></div> <div><p>www.flerlagetwins.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*H9HczlBYqoLkS2K1)"></div> </div> </div> </a> </div><div id="1e5f" class="link-block"> <a href="https://www.dataplusscience.com/DataDensification.html"> <div> <div> <h2>Data Densification Using Domain Completion and Domain Padding</h2> <div><h3>4/22/2020 Data Densification Using Domain Completion and Domain Padding One of the more complicated topics in Tableau…</h3></div> <div><p>www.dataplusscience.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*AJ4vhAYuN0p5TsB_)"></div> </div> </div> </a> </div></article></body>

Hands-on Tutorials

Data Densification in Tableau Desktop

How to show detailed data in a Tooltip by Measures without an ETL

Tableau Desktop’s image by the Author.

If you want to do the previous image can be challenging if you don't have a proper data model with a dimension that allows slices of data. I will explain a quick method to solve this problem without changing the original data.

The Data

Many times we got trouble because our measures are coming as columns instead of rows, and we cannot find the values A, B, C, and D in one single column:

Tableau Desktop’s image by the Author.

Suppose you have a small amount of data (a few million records or less). In that case, you can use the Data Densification method in Tableau Desktop to build the previous chart without modifying your Data Source.

If your data has a more significant volume, I recommend using a proper ETL or Data Flow Software like Tableau Prep Builder, Alteryx, Informatica, AWS Glue, etc. It also applies to SQL, Python Pandas, or Spark. And you can still use the Data Densification method there.

What is Densification?

Densification is the act of becoming or making denser.

What is Data context?

It means to produce more rows from your current data. In some cases, adding columns and doing feature engineering can also count as Data Densification, but I will focus only on rows to simplify.

To clarify, depending on your background, you can use different names to referees to rows, for example, records or observations, and to columns, in this context, features or measures.

Why do we need it?

As a general rule, to fill the gap with pre-calculated data to use it as a dimension, we can slice, for example, if you need to present LATAM and CAM as another bar in a list of countries, the missing days between dates to do a calculation.

How can I use it in Tableau Desktop to show more data in my Tooltip?

First, create a new file only with the list of measures or features.

densification.csv contains a list of measures or features—sublime Text’s image by the Author.

Second, create a relationship with the current data by dragging the file name into the canvas:

Tableau Desktop’s image by the Author.

Modify the relation doing clicking over the orange line and creating Relationship Calculation with the number 1 on both sides. These will be used as a SQL Cross Join by Tableau when bringing the data.

Tableau Desktop’s image by the Author.

Create a new calculated field with the name Measure Selected as the following. Keep in mind that all the measures have to share the same Data Type and the same format.

CASE [Measures]
    WHEN "A" THEN [A]
    WHEN "B" THEN [B]
    WHEN "C" THEN [C]
    WHEN "D" THEN [D]
END

This calculated field is going to map the measures:

Measure Selected calculated field—Tableau Desktop’s image by the Author.

And create a new calculated field with the name Highlight as the following:

IF  {FIXED  [Measures]:max([Measure selected])} = [Measure selected] THEN
    0
ELSE
    1
END

I will highlight the bar's maximum values by dates in the Tooltip, comparing the full amount of a measure versus the current value.

Tableau Desktop’s image by the Author.

You will then notice when you move the measures dimension, the new column from the densification.csv file produces dense data in each of the Measures Names.

Measures Names vs. Measures—Tableau Desktop’s image by the Author.

Using the Measure selected field, you will see only the relevant value by Measure dimension:

Measure selected calculated field—Tableau Desktop’s image by the Author.

Because we are using relationships, you don’t need to worry about duplicate values when you group each of the measures separately. In older Tableau versions, you have to create an extra Set where choose one element of our measures list to filter the data.

Now you can use it as a dimension to pass the value to the Tooltip sheet.

Bars — Densified sheet. Tableau Desktop’s image by the Author.
Bars — Densified sheet Tooltip. Tableau Desktop’s image by the Author.
Tooltip — Densified sheet. Tableau Desktop’s image by the Author.

To produce the visualization that we were looking for:

Tableau Desktop’s image by the Author.

But why doesn't work with Measure Names?

Tableau Desktop’s image by the Author.

The main reason is that Measure Names is a calculated field that creates a discrete list of all the measures but doesn’t exist in the dataset and, because of that, cannot be passed as a value to the sheet referred by the Tooltip at least until the version of Tableau Desktop 2020.3.1

Bars — Non densified by Measure Names in Tableau Desktop. Tableau Desktop’s image by the Author.
The tooltip of the previous Bars — Non densified sheet referring Tooltip — Non densified sheet—Tableau Desktop’s image by the Author.
Tooltip — Non densified sheet by Date and Measure Names in Tableau Desktop. Tableau Desktop’s image by the Author.

Conclusions

We learned about Data Densification and how to use it in Tableau Desktop to filter values through the Tooltip when your model doesn't have a dimension representing each of the measures' names.

Also, we saw that independent of how advanced is Software that you are using, the expertise or domain that you have, you always will find a limitation, and to solve it, you need to think out of the box and be creative.

Thanks

To finish, I want to thank Daniel Dorronsorro for asking me about it. And Rosario Gauna, who push me to continue writing about these topics.

Happy Viz!

Helpful resources

Tableau
Data Density
Densification
Measure Names
Hands On Tutorials
Recommended from ReadMedium