The definition of bins or buckets for histogram may never change. However data in one bucket may go to another at a different time. Thus histogram may change over time. This is what came up in a recent post for tracking status change. This is an example of dynamic histogram evolving in time.

Tracking Status Change

In this case, there are 4 status for all contracts, that is, 4 buckets. At a different date, the status of a contract may change to a different one. Thus the number of contracts per status will change over time. The requirement is to visualize the number of contracts per each status at all time.
Filling the Table

The original data table as above is dotted with status changes. When status remains unchanged, the table cell is blank. Before counting the number of contracts in each of the status, we need to fill the table with actual status. The following formula [Filled Status] allows us to fill each cell with status:
  • IF Isnull(Lookup(Avg(1),0)) THEN Previous_Value()
  • ELSE Min([Status])
  • END
And we get a table as follows:
Counting Numbers

By dragging [Fill Status] to Row shelf, we obtain the table below. Filled Status is computed using Table Across by default. Each square is one [Contract ID]. Histogram is about counting numbers in every bucket. Visually, we see the number of squares in those bucket but we need formula and logic to get the real numbers.
By [WindowCount], we are able to count the number of Contract IDs in each status and at every date.
  • Case [Fill Status]
  • When 'A' then WINDOW_COUNT(if [Fill Status]='A' then [Fill Status] end )
  • When 'B' then WINDOW_COUNT(if [Fill Status]='B' then [Fill Status] end )
  • When 'C' then WINDOW_COUNT(if [Fill Status]='C' then [Fill Status] end )
  • When 'D' then WINDOW_COUNT(if [Fill Status]='D' then [Fill Status] end )
  • End
Drag [WindowCount] to the Text/Label shelf. Right click on [WindowCount] and select Edit Table Calculation. We need to set table calculation for 2 calc fields:
  • Set [WindowCount] to compute using Contract ID 
  • Set [Fill Status] to compute using Table Across or Status Date Change

Indexing and Filtering

This part deals with selecting values using 2-dimensional indexing. Quite a challenging scheme!

We got multiple instances of the same value in each bucket and we just need one. This is achieved by indexing and filtering.

Indexing of all 16 Contract IDs is done for every date, by right clicking it and selecting Compute Using>Contract ID.
It suffices to pick the first value in each bucket. [Windex] comes into play and gives us the lowest index for each bucket.
  • Case [Fill Status]
  • When 'A' then WINDOW_MIN(if [Fill Status]='A' then index() end )
  • When 'B' then WINDOW_MIN(if [Fill Status]='B' then index() end )
  • When 'C' then WINDOW_MIN(if [Fill Status]='C' then index() end )
  • When 'D' then WINDOW_MIN(if [Fill Status]='D' then index() end )
  • End
The table calculation settings of [Windex] is similar to [WindowCount].
Using [Index]=[Windex] as condition, we get a single value [OneCount] for each bucket and make the rest of the bucket Null:
  • If index()=[Windex] Then [WindowCount] End
We see a single value at the lowest index position in each bucket. And all those Nulls are blank.

There are 4 calculated fields of which table calculation needs to be set:
  • [OneCount], [Windex], [WindowCount] are computed using [Contract ID]. 
  • [Fill Status] needs to be calculated using [Status Date Change].

By holding down Ctrl key and dragging [OneCount] from Text shelf into the Filter shelf and select Special>Non-Null Values, we will filter all the Nulls. There you go. We get a table as below where there is a single value or null in each bucket.
Dressing Up

And then we can add a bit more color to it by dragging [Filled Status] to Color shelf, and [OneCount] to Row shelf and selecting bar chart.
Download the workbook by clicking the image above.
4

View comments

(Refresh the page if you want to view the gif image multiple times. Or go to Tableau Public and click the button at the top-right corner.)

Jake and I collaborated on a dashboard. He told me that he learnt a way to create an in-place help page in Tableau. He first saw it at a conference somewhere and couldn't recall who the speaker was. So I am blogging here about it but the credit goes to somebody else. If anyone knows who the original creator is, leave a comment below.

The key idea is to float a semi transparent worksheet on top of the dashboard, where a help text box is strategically placed on top of each chart. This way, we can explain how to view each chart and what data points are important, etc. This worksheet is collapsible by a show/hide button. 

Below I would like to show how this worksheet can be constructed.

1. Sheet with a single data mark.

  • Double click the empty space in Marks panel and add two single quotes. Make the null pill a text label. This creates a single null mark.
  • Set the view as "Entire View"

2. Create an show/hide button

  • Go to the target dashboard
  • Drag a floating vertical container to the dashboard, making it cover all the area of interest.
  • Drag the Single Null Mark sheet and drop it into the above container. Hide the sheet title.
  • Create an open/close button for the container and place the button at the top-right corner.

3. Add annotations

  • Format the sheet background opacity as 70% in the layout manager             
  • Select area annotations and place them anywhere of interest. 
  • Write help text and format it to highlight important messages.  
  • The text can serve as functional guide and/or insight guide.

Here is an example. Feel free to download the workbook and explore. Click the "i" button at the top-right corner to view the in-place help. 

0

Add a comment

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