SlideShare a Scribd company logo
Tableau calculations &
expressions
Rohith Murthy
Non sharable
Industry Synergized
Tableau operators
• Types of Operator
• General Operators
• Arithmetic Operators
• Relational Operators
• Logical Operators
Operators
• + ( adds two numbers or concatenates two strings ).
• - ( Subtracts two numbers or dates ).
• * ( Numeric multiplication ).
• / ( Numeric division ).
• % ( Reminder of numeric division ).
• ^ ( Raised to the power ).
Operators
• = or == ( equal ).
• != or <> ( not equal to ).
• > ( greater )
• < ( less than )
• Logical ( AND, OR, NOT )
Tableau Functions
• Any data analysis involves a lot of calculations. In Tableau, the calculation
editor is used to apply calculations to the fields being analyzed. Tableau has
a number of inbuilt functions which help in creating expressions for complex
calculations.
• Following are the description of different categories of functions.
• Number Functions
• String Functions
• Date Functions
• Logical Functions
• Aggregate Functions
Number Functions
• CEILING(2.145) = 3
• POWER(5,3) = 125
• ROUND(3.14152,2) = 3.14
String Functions
• LEN("Tableau") = 7
• LTRIM(" Tableau ") = "Tableau“ ( trims space ).
• REPLACE("GreenBlueGreen", "Blue", "Red") = "GreenRedGreen“
• UPPER("Tableau") = "TABLEAU"
Date Functions
• DATEADD (date_part, increment, date)
• DATEADD ('month', 3, #2004-04-15#) = 2004-0715 12:00:00 AM
• DATENAME (date_part, date, [start_of_week])
• DATENAME('month', #200404-15#) = "April“
• DAY (date)
• DAY(#2004-04-12#) = 12
• NOW( )
• NOW( ) = 2004-04-15 1:08:21 PM
Logical Functions
• These functions evaluate some single value or the result of an
expression and produce a boolean output.
• IFNULL (expression1, expression2)
• IFNULL([Sales], 0) = [Sales]
• ISDATE (string)
• ISDATE("11/05/98") returns true or false
• MIN(expression) returns min of expression.
Aggregate Functions
• AVG(expression) – numerical fields only.
• COUNT (expression) – returns number of items
• Median (expression) – returns median of expression
• STDEV (expression) - Returns the statistical standard deviation of
all values in the given expression based on a sample of the
population.
Calculations
• Numeric calculations in Tableau are done using a wide range of
inbuilt functions available in the formula editor.
• We will see how to apply calculations to the fields. The
calculations can be as simple as subtracting the values of two
fields or applying an aggregate function to a single field.
• Create a profit_n_discount field by fields [profit]-[discount]
• Shipmode in columns profit_n_discount in rows.
• Avg_Sales calc field Avg[Sales] in rows.
String calculations
• Sales in column and City in rows.
• City_o calc field
• Formula CONTAINS([City],"o")
• Drop City_o in filters and make it true.
Date Calculations
• Create date_diff calc field
• Formula DATEDIFF('month',#2009-
03-21#,[Ship Date])
• Drop date_diff in dimensions
• Month(Ship Date) and date_diff in
rows
• Showme to horizontal bars
Quick table
calculations
• Select the measure on which the
table calculation has to be applied
and drag it to column shelf
• Right-click the measure and choose
the option Quick Table Calculation
….
Quick Table calculations
• Quick table calculations are transformations you can apply to the
values in a visualization.
• You can use table calculations for a variety of purposes,
including:
• Transforming values to rankings.
• Transforming values to show running totals.
• Transforming values to show percent of total.
Quick table calculations
• Choose one of the following options to be applied on the measure.
• Running Total
• Percent Difference
• Percent of Total
• Rank
• Percentile
• Moving Average
• Year to Date (YTD) Total
• Compound Growth Rate
• Year over Year Growth
• Year to Date (YTD) Growth
Quick table calculations
• Table calculations allow you to transform values at the level of detail of
the visualization only.
• Setup Visualization
• Drag Order Date to the Columns shelf.
• Drag State to the Rows shelf.
• Drag Sales to Text on the Marks Card
• Drag Profit to Color on the Marks Card.
• On the Marks card, click the Mark Type drop-down and select Square.
• Right click on profit and perform quick table calculations.
Tableau Level of Detail ( LOD )
• Used to run complex queries.
• There are three main types of LOD expressions.
• FIXED LOD This expression computes values using the specified
dimensions without reference to any other dimensions in the view.
• INCLUDE LOD This level of detail expressions compute values
using the specified dimensions in addition to whatever dimensions
are in the view.
• EXCLUDE LOD These levels of detail expressions subtract
dimensions from the view level of detail.
Level Of Detail
• They can be performed at a
• more granular level (INCLUDE),
• a less granular level (EXCLUDE),
• or an entirely independent level (FIXED).
Fixed Level of Detail
• Find the sales in each region
• Sales in column, region and state in rows.
• Q> Find the amount of Sales for each state in each region?
• First create the formula field named Regional Sales using the formula.
• {FIXED [Region] : SUM ([Sales])}
• Drag the Region and State field to the Rows shelf and the calculated
field to the Text shelf under the Marks card.
Include Level Of Detail
• Q> Calculate the sum of sales per
state for each sub-category of
products.
• Drag the Sub-Category field to the
Rows shelf.
• INCLUDE level of detail expressions
compute values using the specified
dimensions in addition to whatever
dimensions are in the view.
• { INCLUDE [State] : SUM(Sales) } in
columns
EXCLUDE Level of Detail
Expressions
• Exclude Region from Sales figure
calculated for every month
• { EXCLUDE [Region] : SUM([Sales])}
• EXCLUDE level of detail expressions
specify dimensions to exclude from
the view level of detail.
When to use calculations
• Some examples might include:
• To segment data
• To convert the data type of a field, such as converting a string to a
date.
• To aggregate data
• To filter results
• To calculate ratios
Scenarios to
use
Calculations
• The data you need for your analysis is missing
from your data source. You need cost and you
have sales and profit.
• Create a Cost field by [Sales] – [Profit] in
Columns
• You want to quickly categorize data.
• IF SUM([Profit]) > 0
THEN "Profitable"
ELSE "Nonprofitable"
END
• You want to transform values in your
visualization.
• Calculate the difference in profit from one year to
the other.
• Yeardate in column, Category & subcategory in
rows. Profit in color and label.
Tableau interface and metadata Ends..
BE HAPPY AND THINK
SERIOUS IN LIFE.
THANK YOU .

More Related Content

PPTX
Bar chart Creation
PDF
Business Analytics 1 Module 4.pdf
PPTX
17TH October 2023 DOE SRM University.pptx
PPTX
Pivot Tables and Beyond Data Analysis in Excel 2013 - Course Technology Compu...
PPTX
Tableau Charts and Graphs Presentation no 4.pptx
PDF
Tableau.pdf
PPT
Tableau PPT.ppt
PPTX
Tableau Desktop Specialist Certification.pptx
Bar chart Creation
Business Analytics 1 Module 4.pdf
17TH October 2023 DOE SRM University.pptx
Pivot Tables and Beyond Data Analysis in Excel 2013 - Course Technology Compu...
Tableau Charts and Graphs Presentation no 4.pptx
Tableau.pdf
Tableau PPT.ppt
Tableau Desktop Specialist Certification.pptx

Similar to Tableau calculations and experience.pptx (20)

PPTX
Business Intelligence Portfolio
PDF
Power BI.pdf
PDF
Presentation top tips for getting optimal sql execution
PPT
Project on Electronic Spreadsheets for Students
PPTX
Parameters in Tableau
PPTX
Access 2013 Unit D
PPTX
DAX (Data Analysis eXpressions) from Zero to Hero
PDF
Adding measures to Calcite SQL
PDF
From 0 to DAX…………………………………………………………..pdf
PPTX
Chris Seebacher Portfolio
PPTX
PPT
electronicspreadsheet.pptx.ppt
PDF
BI Knowledge Sharing Session 2
PPTX
Choosing the Right Charts for Your Boss, Board or Senior Management
PPTX
Microsoft Excel Basics
PPTX
Getting started with Tableau
PDF
Cubing and Metrics in SQL, oh my!
PPTX
DAX_Queries_for_Data_Visualization_Khadi.pptx
PDF
CAD Lecture Note PPT-ETU.pdf for any engineers
PDF
QGIS Tutorial 1
Business Intelligence Portfolio
Power BI.pdf
Presentation top tips for getting optimal sql execution
Project on Electronic Spreadsheets for Students
Parameters in Tableau
Access 2013 Unit D
DAX (Data Analysis eXpressions) from Zero to Hero
Adding measures to Calcite SQL
From 0 to DAX…………………………………………………………..pdf
Chris Seebacher Portfolio
electronicspreadsheet.pptx.ppt
BI Knowledge Sharing Session 2
Choosing the Right Charts for Your Boss, Board or Senior Management
Microsoft Excel Basics
Getting started with Tableau
Cubing and Metrics in SQL, oh my!
DAX_Queries_for_Data_Visualization_Khadi.pptx
CAD Lecture Note PPT-ETU.pdf for any engineers
QGIS Tutorial 1
Ad

Recently uploaded (20)

PDF
Types of control:Qualitative vs Quantitative
PDF
Traveri Digital Marketing Seminar 2025 by Corey and Jessica Perlman
PDF
Laughter Yoga Basic Learning Workshop Manual
PDF
Nidhal Samdaie CV - International Business Consultant
PDF
power sharing oneksr shot revision series-1 Copy.pdf
PDF
Unit 1 Cost Accounting - Cost sheet
PPTX
5 Stages of group development guide.pptx
PPTX
Probability Distribution, binomial distribution, poisson distribution
PPTX
Belch_12e_PPT_Ch18_Accessible_university.pptx
PDF
HOT DAY CAFE , Café Royale isn’t just another coffee shop
PDF
DOC-20250806-WA0002._20250806_112011_0000.pdf
PDF
Reconciliation AND MEMORANDUM RECONCILATION
PDF
Chapter 5_Foreign Exchange Market in .pdf
PDF
Katrina Stoneking: Shaking Up the Alcohol Beverage Industry
PPTX
New Microsoft PowerPoint Presentation - Copy.pptx
PDF
Roadmap Map-digital Banking feature MB,IB,AB
PDF
WRN_Investor_Presentation_August 2025.pdf
PPTX
Markdown Language_ Revolutionizing Text Formatting Made Easy.pptx
PPTX
AI-assistance in Knowledge Collection and Curation supporting Safe and Sustai...
PPTX
ICG2025_ICG 6th steering committee 30-8-24.pptx
Types of control:Qualitative vs Quantitative
Traveri Digital Marketing Seminar 2025 by Corey and Jessica Perlman
Laughter Yoga Basic Learning Workshop Manual
Nidhal Samdaie CV - International Business Consultant
power sharing oneksr shot revision series-1 Copy.pdf
Unit 1 Cost Accounting - Cost sheet
5 Stages of group development guide.pptx
Probability Distribution, binomial distribution, poisson distribution
Belch_12e_PPT_Ch18_Accessible_university.pptx
HOT DAY CAFE , Café Royale isn’t just another coffee shop
DOC-20250806-WA0002._20250806_112011_0000.pdf
Reconciliation AND MEMORANDUM RECONCILATION
Chapter 5_Foreign Exchange Market in .pdf
Katrina Stoneking: Shaking Up the Alcohol Beverage Industry
New Microsoft PowerPoint Presentation - Copy.pptx
Roadmap Map-digital Banking feature MB,IB,AB
WRN_Investor_Presentation_August 2025.pdf
Markdown Language_ Revolutionizing Text Formatting Made Easy.pptx
AI-assistance in Knowledge Collection and Curation supporting Safe and Sustai...
ICG2025_ICG 6th steering committee 30-8-24.pptx
Ad

Tableau calculations and experience.pptx

  • 1. Tableau calculations & expressions Rohith Murthy Non sharable Industry Synergized
  • 2. Tableau operators • Types of Operator • General Operators • Arithmetic Operators • Relational Operators • Logical Operators
  • 3. Operators • + ( adds two numbers or concatenates two strings ). • - ( Subtracts two numbers or dates ). • * ( Numeric multiplication ). • / ( Numeric division ). • % ( Reminder of numeric division ). • ^ ( Raised to the power ).
  • 4. Operators • = or == ( equal ). • != or <> ( not equal to ). • > ( greater ) • < ( less than ) • Logical ( AND, OR, NOT )
  • 5. Tableau Functions • Any data analysis involves a lot of calculations. In Tableau, the calculation editor is used to apply calculations to the fields being analyzed. Tableau has a number of inbuilt functions which help in creating expressions for complex calculations. • Following are the description of different categories of functions. • Number Functions • String Functions • Date Functions • Logical Functions • Aggregate Functions
  • 6. Number Functions • CEILING(2.145) = 3 • POWER(5,3) = 125 • ROUND(3.14152,2) = 3.14
  • 7. String Functions • LEN("Tableau") = 7 • LTRIM(" Tableau ") = "Tableau“ ( trims space ). • REPLACE("GreenBlueGreen", "Blue", "Red") = "GreenRedGreen“ • UPPER("Tableau") = "TABLEAU"
  • 8. Date Functions • DATEADD (date_part, increment, date) • DATEADD ('month', 3, #2004-04-15#) = 2004-0715 12:00:00 AM • DATENAME (date_part, date, [start_of_week]) • DATENAME('month', #200404-15#) = "April“ • DAY (date) • DAY(#2004-04-12#) = 12 • NOW( ) • NOW( ) = 2004-04-15 1:08:21 PM
  • 9. Logical Functions • These functions evaluate some single value or the result of an expression and produce a boolean output. • IFNULL (expression1, expression2) • IFNULL([Sales], 0) = [Sales] • ISDATE (string) • ISDATE("11/05/98") returns true or false • MIN(expression) returns min of expression.
  • 10. Aggregate Functions • AVG(expression) – numerical fields only. • COUNT (expression) – returns number of items • Median (expression) – returns median of expression • STDEV (expression) - Returns the statistical standard deviation of all values in the given expression based on a sample of the population.
  • 11. Calculations • Numeric calculations in Tableau are done using a wide range of inbuilt functions available in the formula editor. • We will see how to apply calculations to the fields. The calculations can be as simple as subtracting the values of two fields or applying an aggregate function to a single field. • Create a profit_n_discount field by fields [profit]-[discount] • Shipmode in columns profit_n_discount in rows. • Avg_Sales calc field Avg[Sales] in rows.
  • 12. String calculations • Sales in column and City in rows. • City_o calc field • Formula CONTAINS([City],"o") • Drop City_o in filters and make it true.
  • 13. Date Calculations • Create date_diff calc field • Formula DATEDIFF('month',#2009- 03-21#,[Ship Date]) • Drop date_diff in dimensions • Month(Ship Date) and date_diff in rows • Showme to horizontal bars
  • 14. Quick table calculations • Select the measure on which the table calculation has to be applied and drag it to column shelf • Right-click the measure and choose the option Quick Table Calculation ….
  • 15. Quick Table calculations • Quick table calculations are transformations you can apply to the values in a visualization. • You can use table calculations for a variety of purposes, including: • Transforming values to rankings. • Transforming values to show running totals. • Transforming values to show percent of total.
  • 16. Quick table calculations • Choose one of the following options to be applied on the measure. • Running Total • Percent Difference • Percent of Total • Rank • Percentile • Moving Average • Year to Date (YTD) Total • Compound Growth Rate • Year over Year Growth • Year to Date (YTD) Growth
  • 17. Quick table calculations • Table calculations allow you to transform values at the level of detail of the visualization only. • Setup Visualization • Drag Order Date to the Columns shelf. • Drag State to the Rows shelf. • Drag Sales to Text on the Marks Card • Drag Profit to Color on the Marks Card. • On the Marks card, click the Mark Type drop-down and select Square. • Right click on profit and perform quick table calculations.
  • 18. Tableau Level of Detail ( LOD ) • Used to run complex queries. • There are three main types of LOD expressions. • FIXED LOD This expression computes values using the specified dimensions without reference to any other dimensions in the view. • INCLUDE LOD This level of detail expressions compute values using the specified dimensions in addition to whatever dimensions are in the view. • EXCLUDE LOD These levels of detail expressions subtract dimensions from the view level of detail.
  • 19. Level Of Detail • They can be performed at a • more granular level (INCLUDE), • a less granular level (EXCLUDE), • or an entirely independent level (FIXED).
  • 20. Fixed Level of Detail • Find the sales in each region • Sales in column, region and state in rows. • Q> Find the amount of Sales for each state in each region? • First create the formula field named Regional Sales using the formula. • {FIXED [Region] : SUM ([Sales])} • Drag the Region and State field to the Rows shelf and the calculated field to the Text shelf under the Marks card.
  • 21. Include Level Of Detail • Q> Calculate the sum of sales per state for each sub-category of products. • Drag the Sub-Category field to the Rows shelf. • INCLUDE level of detail expressions compute values using the specified dimensions in addition to whatever dimensions are in the view. • { INCLUDE [State] : SUM(Sales) } in columns
  • 22. EXCLUDE Level of Detail Expressions • Exclude Region from Sales figure calculated for every month • { EXCLUDE [Region] : SUM([Sales])} • EXCLUDE level of detail expressions specify dimensions to exclude from the view level of detail.
  • 23. When to use calculations • Some examples might include: • To segment data • To convert the data type of a field, such as converting a string to a date. • To aggregate data • To filter results • To calculate ratios
  • 24. Scenarios to use Calculations • The data you need for your analysis is missing from your data source. You need cost and you have sales and profit. • Create a Cost field by [Sales] – [Profit] in Columns • You want to quickly categorize data. • IF SUM([Profit]) > 0 THEN "Profitable" ELSE "Nonprofitable" END • You want to transform values in your visualization. • Calculate the difference in profit from one year to the other. • Yeardate in column, Category & subcategory in rows. Profit in color and label.
  • 25. Tableau interface and metadata Ends.. BE HAPPY AND THINK SERIOUS IN LIFE. THANK YOU .