Sunday, January 29, 2017

Add measure to column header

We can add numeric info to the column header to introduce the second measure, or other dimension info as showed in picture below (download workbook).

Steps:
1. Create calculated filed in which we can use STR function to convert number to string, use ATTR to include original dimension break, and use CHAR(10) to insert line break,  e.g. ATTR([Segment])+ CHAR(10) + str([Segment Size]).
 2. Use two dimension as column header. The first is the customized string in step 1, and the second is the original dimension.
3. Uncheck the Show Header on the original dimension.




3 methods to draw wave/break bar chart

When we design bar chart with very different scales along columns, wave/break line can help to call out the scale difference, like this Excel bar chart (original post).


Here I have three methods to draw wave/break bar chart (download workbook):

Saturday, January 10, 2015

Monday, December 29, 2014

SQL script to profile data in table


Script below can be useful to produce a summary of columns in a table.
When we get a new data sources without sufficient document, this script can help us to list the number of NULLs and distinct values, as well as to list the top 50 unique values of a column.

Please download the SQL script: ProfileTable.sql

Use stored procedure in Tableau to optimize consultant practice

The typical workflow of consulting service can be labor-intensive and error-prone. We need to copy data among applications, set up calc sheet in Excel, snip Tableau screenshot, and finally to make the slides reflect the correct information scattered in modeling tools, database, and spread sheets.
What if we simplify the workflow by removing some applications, say, Excel.  
So, here is a proposal to move the calculation in Excel into SQL database with the feature of stored procedure support in Tableau 8.1 and later. 





What if we go even further, say, replace PowerPoint slides with Tableau Story Points.

Friday, June 21, 2013

Count frequency of factor column

Name: frqTable
Scenario: Want exchange data to Excel, or do the long tail fit

Code:
frqTable <- function(aFactorCol, aColName, aIsDecs="TRUE"){
  ret <- as.data.frame(table(aFactorCol))
  colnames(ret) <- c(aColName,'frq')
  ret <- ret[order(ret$frq,decreasing=aIsDecs),]
  rownames(ret) <- NULL
  return (ret);
}