Home  >  Blog  >   Tableau

Tableau Case Statements

Rating: 5
  
 
20793
  1. Share:
Tableau Articles

Introduction:

Tableau is a rapid-fire business intelligence software that allows you to make decisions at a very fast pace. Tableau is also a leading new generation Business Intelligence (BI) application which is also dubbed as a “self-service” data discovery tool as it can be achieved with almost no support from IT staff. This product shines as a graphical tool or a visualization tool, where you would have relied on various other tools and takes longer durations to represent the bar charts or the pie charts. Tableau is built to perform and it provides very quick visual analytics.

Tableau provides you with a wonderful feature of performing logical checks and based on the outcome to do something.

Tableau Course Offer

Want to become a Master in Tableau Course? Then visit to learn Tableau Certification Training at Mindmajix

Overview of Case Statements in Tableau:

Usage of the CASE statement from programming languages as like C to C++ or even to Java doesn’t differ much. To that point, the CASE statements can be used on RDBMS servers like Oracle, SQL Server and the like. The feature is no different in Tableau Desktop as well, it enables an individual to make logical decision making and then based on the outcome of the case, a specific action can be written to be performed. In plain English, CASE scenario1 THEN perform action1. To be precise, CASE is simpler to use than a complicated and nested IF and ELSE statements.

[Related Article: What Are The Common Use Cases For Tabcmd In Tableau?]

CASE function evaluates the expression and matches the outcome to the values presented as scenarios and then returns the matched value. If there is no match found, then the default return expression will be used. Typically, a CASE statement is used to search for a match to an expression, which is always concise than an implementation using IF and ELSE statements. Now with this basic introduction into the concept of CASE statements, let us take some general examples and see how this can be put to use in Tableau Desktop to achieve what is expected out of the software.

 MindMajix YouTube Channel

Let us consider a few examples to understand the concepts that we have discussed until now:

CASE  [ Runs ]     WHEN ‘Six’ THEN 6

WHEN ‘Four’ THEN 4

WHEN ‘Triple’ THEN 3

WHEN ‘Double’ THEN 2

WHEN ‘Single’ THEN 1

Let us take a look at another example to see the usage of the CASE statement:

CASE [Direction] WHEN ‘EAST’ THEN 1

          WHEN ‘WEST’ THEN 2

         WHEN ‘NORTH’ THEN 3

         WHEN ‘SOUTH’ THEN 4

Checkout Tableau Tutorials

If you want to create CASE statements that could be used in the evaluation of Parameters or Dashboards or Reports, you can create and save them on Tableau Desktop. Let us see how we can create them on Tableau Desktop in the steps provided below:

  • On the Analysis tab, click on the option ‘Create Calculated Field’

  • This opens up a new tabular pane for recording your calculation formula

CASE [Region]  WHEN 'Shanghai' THEN 'APAC'

              WHEN 'Hong Kong' THEN 'APAC'

              WHEN 'London' THEN 'EMEA'

              WHEN 'Brazil' THEN 'SA'

              WHEN 'Texas' THEN 'NA'

END

A sample screenshot on how this can be saved on Tableau Desktop is shown below:

Tableau Desktop

Once the formula as like that has been shown above is entered, click Ok and save it for further usage.

[Related Article: How To Configure Tableau Server For The First Time?]

Conclusion:

In this article, we have tried to give you a brief about what Tableau as software can provide you or your organization with. Alongside those details, we have provided necessary information about CASE statements and also have seen the performance gain that we get over the usage of IF and ELSE statements.

Hope this article is informative enough to provide all the necessary details at one place for your quicker references.

Related Pages:

Tableau Interview Questions

Tableau Sample Resumes

Tableau Server Tutorial

List Of Tableau Courses:

 Tableau Advanced
 Tableau Server
 Data Visualization and Dashboarding Fundamentals

 

Join our newsletter
inbox

Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!

Course Schedule
NameDates
Tableau TrainingMar 23 to Apr 07View Details
Tableau TrainingMar 26 to Apr 10View Details
Tableau TrainingMar 30 to Apr 14View Details
Tableau TrainingApr 02 to Apr 17View Details
Last updated: 03 Apr 2023
About Author

As a Senior Writer for Mindmajix, Saikumar has a great understanding of today’s data-driven environment, which includes key aspects such as Business Intelligence and data management. He manages the task of creating great content in the areas of Programming, Microsoft Power BI, Tableau, Oracle BI, Cognos, and Alteryx. Connect with him on LinkedIn and Twitter.

read more
Recommended Courses

1 / 15