Zen Master Jonathan Drummey left a comment in Creating Bins Made Easy, saying that he is not using "IF ... ELSEIF..." statement when creating bins of equal size. Instead, he just creates a calculated field with some math wizardry. How brilliant! Jonathan's repertoire is infinite. Let's see how it works.

We use the same example as in Creating Bins Made Easy where we need to create bins of equal size on percentiles. The number of bins is 25. And we want to label the bins from 1 to 25. (If your number of bins is N, just replace 25 by N in the following.)

1.Via Ceiling()

The formula for the calc field is

Ceiling(Percentile*25)  Ceiling() is a new function introduced in Tableau 9. However it doesn't work with table calculations.
1

This is a sequel to Coding Case Statement Made Easy.  This topic came up when a colleague needs to create 25 uniform bins on percentiles. Quite a bit of manual work, isn't it?

It is pretty easy if you create bins of equal size on regular measures or dimensions. You can use the right-click context menu "Create Bins" in Tableau to create them.

It becomes tedious when working with aggregated measures (no context menu available for creating bins), especially when the number of bins is big.
5

The title seems to imply that coding case statement is not easy. It's actually more tedious than difficult. It's mechanical, manual and repetitive. The more options in the statement, the worse it gets.

Let's use a recent example where the expected case statement is as follows:

Manually writing the above code is quite tedious. Moreover, manual coding those options is error prone. Using tools to help generate clean code can avoid those errors and save time in debugging.
2

The Problem

When dealing with large data sets in a .tde file, the responsiveness of Tableau is reduced to the minimum. The design process may become intolerable. Every bit of change or drag or drop takes long time for Tableau to calculate and to render. The viz designer (aka me) has to wait and wait.

All I wanted is to get the logic right first. I need to move pills around freely and create a few calculated fields just for trying. I need quick response from Tableau.
3

Replacing data source in Tableau has not been a pleasant task for many of us. I wrote about it a while ago:

Replacing Data Source Breaks Everything: Cause, Workaround & Ultimate Fix

To minimize the pain, you can follow these steps. Before replacing, do these:

1.Hold ctrl key to multi-select all calc fields, groups, sets etc (Right click and select Copy)

2.Right click Dimensions or Measures shelf in the new data source, and paste all of them in one shot.
3
Blog Archive
Loading
Dynamic Views theme. Powered by Blogger. Report Abuse.