EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login
Home Data Science Data Science Tutorials Tableau Tutorial LOOKUP Function in Tableau
Secondary Sidebar
Tableau Tutorial
  • Functions
    • Tableau Functions
    • Tableau String Functions
    • Concatenate in Tableau
    • Rank Function in Tableau
    • Tableau Aggregate Functions
    • Window Sum Tableau
    • LOD Expressions in Tableau
    • LOOKUP Function in Tableau
    • Tableau Fixed Function
    • Tableau Count Distinct
    • Tableau Window Functions
  • Basic
    • What is Tableau
    • What is Tableau Dashboard
    • What is Tableau Server
    • Uses of Tableau
    • Tableau Versions
    • Tableau Architecture
    • Is Tableau Free
    • Tableau New Features
    • How To Install Tableau
    • How to Use Tableau?
    • Install Tableau Server
    • Tableau Commands
  • Charts
    • Tableau Charts
    • Tableau Bar Chart
    • Tableau Chart Types
    • Donut Chart in Tableau
    • Tableau Gauge Chart
    • Funnel Chart in Tableau
    • Gantt Chart in Tableau
    • Bubble Chart in Tableau
    • Pareto Chart in Tableau
    • Sankey Chart In Tableau
    • Stacked Bar Chart in Tableau
    • Tableau Bullet Chart
    • Waterfall Chart in Tableau
    • Line Chart in Tableau
    • Heat Map in Tableau
    • Histogram in Tableau
    • CrossTab in Tableau
    • Treemap in Tableau
    • Trend Lines in Tableau
    • Tableau Reference Lines
    • Tableau Dual Axis
    • Legend in Tableau
    • Pie Chart in Tableau
    • Tableau Storyline
  • Statement
    • Tableau IF Statement
    • Case Statement in Tableau
  • Sort/Filters
    • Sorting in Tableau
    • Filters in Tableau
    • Types of Filters in Tableau
    • Tableau Action Filter
    • Context Filter in Tableau
    • Tableau Parameter Filter
    • Adding Filters in Tableau Dashboard
    • Tableau Context Filter
  • Tableau Dashboard
    • Dashboard in Tableau
    • Tableau Dashboard Examples
    • Tableau Dashboard Creation
    • Tableau Dashboard Design
    • Tableau Workbook
  • Advanced
    • Tableau Bins
    • Tableau 3D
    • Tableau Export to Excel
    • Tableau Reporting
    • Tableau Reader
    • Tableau Map
    • Tableau Viewer
    • Tableau Prep Builder
    • Tableau Bridge
    • Tableau Tooltip
    • Tableau Hyper
    • Tableau Zen Master
    • Tableau Union
    • Tableau Templates
    • Tableau Alerts
    • Tableau Reporting Tool
    • Conditional Formatting in Tableau
    • Tableau Web Data Connector
    • Tableau BI Tool
    • Data Blending in Tableau
    • Parameters in Tableau
    • Tableau Data Sets
    • Creating Set in Tableau
    • Tableau Drill Down
    • Tableau Dynamic Parameters
    • Tableau Table Calculation
    • Tableau Visualization
    • Tableau Joins
    • Pivot in Tableau
    • Data Visualization With Tableau
    • Forecast in Tableau
    • Map Layers in Tableau
    • Group in Tableau
    • Tableau Group by
    • Hierarchy in Tableau
    • Sets in Tableau
    • How to create a Set in Tableau
    • Tableau Order of Operations
    • Tableau User Group
    • Tableau Calculated Field
    • Custom SQL in Tableau
  • Interview Questions
    • Tableau Interview Questions

Related Courses

Tableau Certification Course

Business Intelligence Courses

Data Visualization Courses

LOOKUP Function in Tableau

By Priya PedamkarPriya Pedamkar

Lookup Function in Tableau

Introduction to Lookup Function in Tableau

This article will explore the Lookup Function in Tableau. The lookup function is one of the most important and widely used table calculations in Tableau and is used to find values from a selected range. As the name suggests it is used to lookup values within a table (partition) i.e. either from the start of the partition or from the end. The value fetched is based on the offset value which defines the position (either positive or negative) from the current row. The value (measure/dimension) which needs to be looked up is specified in the syntax and the position is based on the offset. Offset is something that specifies the number of addresses which is added to the base address to get an absolute address.

Difference between Excel Lookup and Tableau Lookup

Excel also provides the lookup feature in terms of vlookup and hlookup. However, lookup in excel is used extensively to extract the values from a different table while Tableau lookup will fetch the data from within the table based on the offset values.

The syntax for Lookup function: [expression, offset]

Expression: The first part of the function is the aggregate of measure or dimension that will be returned.

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

Offset: This refers to the number which will specify in which direction should tableau move (Positive or negative) and by how much from the current row value. That means it specifies the position to fetch the value specified in the first part. Offset basically refers to the distance in cells from the starting of the table or from the end of the table. It can be a hardcoded number, a parameter or a formula. If the offset is a negative value it will lookup the previous rows and if the value is positive it will lookup the upcoming row’s values.

Let’s understand this topic using working examples.

Example #1

Data Source Being Setup

We have a sample dataset that has data about the unemployment numbers in the US for 5 years (2005-2010). It consists of unemployment numbers for different age groups for each month. The unemployment numbers are specified for both men and women separately.

Loopkup function - Excel

1. After launching Tableau, connect to the excel file mentioned above using the connect option on the Tableau landing page. Select the excel option and browse to your data file.

Lookup function Landing page

2. Once the file is selected and opened, you will be navigated to the data source view of the tableau. In the data source tab, it displays how the data source is being set up and also displays the first 1000 rows of the data. And to go to the worksheet click on Sheet 1.

Lookup Function Data Source

3. Tableau will automatically identify the numeric values (Measures) and the categorical value (Dimensions).

the numeric values

4. Drag and drop the Period value from the dimensions to rows pane. Also, move the unemployed measure over the text box in the marks pane. This would result in a table as shown in the below figure.

The Period value

5. To introduce the concept of lookup, create a calculated field named Previous year unemployed using lookup function with an offset of 1.

Concept of Lookup

 

All in One Data Science Bundle(360+ Courses, 50+ projects)
Python TutorialMachine LearningAWSArtificial Intelligence
TableauR ProgrammingPowerBIDeep Learning
Price
View Courses
360+ Online Courses | 50+ projects | 1500+ Hours | Verifiable Certificates | Lifetime Access
4.7 (86,527 ratings)

 

 

 

 

 

6. Drag and drop the newly created calculated field towards the table.

Created calculated field

Thus Tableau has extracted the previous year’s unemployment numbers with the help of the lookup functionality. We can keep changing the offset value to fetch the numbers based on our needs. A value of 1 will look up the immediate next year’s value and display on the table.

Example #2

Parameter Control for Offset

You can also dynamically change the offset value by introducing the concept of the parameter. The parameter will give the liberty to change the offset value in the visualization itself, rather than editing the calculation field each time to change the number. We need to do a few changes in our workspace such as adding a new parameter and using that parameter in our lookup function.

1. Right-click on the measures pane and select the ‘create parameter’ option. Specify the name and current value. The current value will be the same which you want the offset value to be.

Create parameter

2. Now modify the calculated field by replacing the parameter name with the offset value.

The offset value

3. The workspace will thus look something like this. This feature will be very useful while creating dashboards and stories.

 The workspace

Example #3

To Calculate the Difference in the Unemployment Numbers Compared to the Previous Year using Lookup

Create a new calculated field in which we will make the difference between the current value and the value specified based on the offset

LOOKUP Function Unemployment Numbers

Drag and drop this new calculated field over the table.

New calculated field over the table

Use cases for Lookup Function

  • Lookup function does the calculation and provides the quarterly sales for each year in a table calculation.
  • Consider an example of a sales data of an organization whose sales tend to change seasonally. There may be more sales during Christmas week rather than any normal weekend. Thus to compare sales at the same time periods in consecutive years we use the lookup function in tableau. Lookup functions are used to extract values that are offset from a target column.
  • To compare quarterly sales for over a period of time.
  • Annual subtotal for various years.

Conclusion

Below are the major highlights of the Lookup function –

  • The most widely used Table calculation and is used to lookup value within the table based on the offset position.
  • Every time changing the offset value in the calculated field is tedious work, thus Tableau handles it through Parameter. The offset value can be replaced by a parameter and giving the parameter control in the view itself. This will make the visualization more interactive.
  • If the offset value specified is more than the number of rows in the table it would return empty results.

Recommended Articles

This is a guide to LOOKUP Function in Tableau. Here we discuss what is LOOKUP Function in Tableau, the difference between Excel Lookup and Tableau Lookup with appropriate examples. You can also go through our other suggested articles to learn more –

  1. Stacked Bar Chart in Tableau
  2. Tableau Date Functions
  3. What are the Tableau Alternatives?
  4. What is Tableau? | Uses and Applications
  5. Learn the Examples of Lookup in MongoDB
Popular Course in this category
Tableau Training (8 Courses, 8+ Projects)
  8 Online Courses |  8 Hands-on Projects |  55+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course

Related Courses

Business Intelligence Training (12 Courses, 6+ Projects)4.9
Data Visualization Training (15 Courses, 5+ Projects)4.8
0 Shares
Share
Tweet
Share
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Data Science Course

SPSS, Data visualization with Python, Matplotlib Library, Seaborn Package

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more