Book Image

Mastering Tableau 2019.1 - Second Edition

By : Marleen Meier, David Baldwin
Book Image

Mastering Tableau 2019.1 - Second Edition

By: Marleen Meier, David Baldwin

Overview of this book

Tableau is one of the leading business intelligence (BI) tools used to solve BI and analytics challenges. With this book, you will master Tableau's features and offerings in various paradigms of the BI domain. This book is also the second edition of the popular Mastering Tableau series, with new features, examples, and updated code. The book covers essential Tableau concepts and its advanced functionalities. Using Tableau Hyper and Tableau Prep, you’ll be able to handle and prepare data easily. You’ll gear up to perform complex joins, spatial joins, union, and data blending tasks using practical examples. Following this, you’ll learn how to perform data densification to make displaying granular data easier. Next, you’ll explore expert-level examples to help you with advanced calculations, mapping, and visual design using various Tableau extensions. With the help of examples, you’ll also learn about improving dashboard performance, connecting Tableau Server, and understanding data visualizations. In the final chapters, you’ll cover advanced use cases such as Self-Service Analytics, Time Series Analytics, and Geo-Spatial Analytics, and learn to connect Tableau to R, Python, and MATLAB. By the end of this book, you’ll have mastered the advanced offerings of Tableau and be able to tackle common and not-so-common challenges faced in the BI domain.
Table of Contents (20 chapters)
Free Chapter
1
Section 1: Tableau Concepts, Basics
9
Section 2: Advanced Calculations, Mapping, Visualizations
16
Section 3: Connecting Tableau to R, Python, and Matlab

Using R functions

Now that we have successfully connected Tableau with R, let's write some code in Tableau to invoke R. Within Tableau, open the Calculated Field Editor.

Notice within the Functions panel those entries beginning with SCRIPT_ ,as shown in the following screenshot:

The SCRIPT functions are used by Tableau to invoke R. The function names communicate the data type of the returned results; SCRIPT_REAL returns float values, SCRIPT_BOOL returns T|F values, and so forth.

The syntax of a SCRIPT function is represented in the following diagram:

Exercise: reproducing native Tableau functionality in R

For our first exercise, we will use the AVG, MEDIAN, and STDEV functions in Tableau and compare the results with...