Book Image

Tableau 10 Business Intelligence Cookbook

By : Donabel Santos, Paul Banoub
Book Image

Tableau 10 Business Intelligence Cookbook

By: Donabel Santos, Paul Banoub

Overview of this book

Tableau is a software tool that can speed up data analysis through its rich visualization capabilities, and help uncover insights for better and smarter decision making. This book is for the business, technology, data and analytics professionals who use and analyze data and data-driven approaches to support business operations and strategic initiatives in their organizations. This book provides easy-to-follow recipes to get the reader up and running with Tableau 10, and covers basic to advanced use cases and scenarios. The book starts with building basic charts in Tableau and moves on to building more complex charts by incorporating different Tableau features and interactivity components. There is an entire chapter dedicated to dashboard techniques and best practices. A number of recipes specifically for geospatial visualization, analytics, and data preparation are also covered. By the end of this book, you’ll have gained confidence and competence to analyze and communicate data and insights more efficiently and effectively by creating compelling interactive charts, dashboards, and stories in Tableau.
Table of Contents (17 chapters)
Tableau 10 Business Intelligence Cookbook
Credits
About the Author
Acknowledgements
About the Reviewer
www.PacktPub.com
Preface
Index

Dealing with NULLs


When working with calculated fields, it is important to understand what NULLs are and how to deal with fields that have NULL values.

A NULL is a missing value. It is an indeterminate value. A NULL is not:

  • a zero

  • a space

  • an empty string

Whenever there is an operation between a field that has a value and a field that has a NULL, the result is always a NULL. When you add 1 to nothing, what is the result? Indeterminate. When you concatenate a first name to an unknown value, what is the result? Indeterminate—we don't know.

Let's take the following data set:

Once you connect this Excel file to Tableau, the initial connection screen will look like the following. Notice how the missing values in Excel appear as NULL in the preview screen:

The following formula will calculate the discount amount correctly if there are no NULL values:

If we try to calculate the total discounted price as normal, using the following formula, we are going to get incorrect results:

Here are a few ways to deal with NULL values:

  • The IFNULL value:

  • The IIF and ISNULL value:

  • The IF…ELSE and ISNULL value:

  • The ZN value:

    Note

    Note that ZN stands for Zero if null, which means this function will only work if the expected return value is numeric.

  • The CASE value:

Each of these calculations will produce a 0 for the discount amount if the discount percentage is missing. This will allow the discounted sales amount, that is, sales less discount amount, to be calculated correctly: