Podcast
Questions and Answers
When creating a calculated field to determine GDP per capita, which calculation accurately represents the relationship between GDP and Population?
When creating a calculated field to determine GDP per capita, which calculation accurately represents the relationship between GDP and Population?
- SUM([GDP]) + SUM([Population])
- SUM([Population]) / SUM([GDP])
- SUM([GDP]) / SUM([Population]) (correct)
- SUM([GDP]) * SUM([Population])
You have a 'Sales' field and a 'Profit' field. You want to determine 'Net Cost'. Which calculation would you use when creating a calculated field?
You have a 'Sales' field and a 'Profit' field. You want to determine 'Net Cost'. Which calculation would you use when creating a calculated field?
- [Profit] - [Sales]
- [Sales] - [Profit] (correct)
- [Sales] + [Profit]
- [Sales] * [Profit]
Which of the following actions can be performed on a string field using calculated fields?
Which of the following actions can be performed on a string field using calculated fields?
- Trimming extra spaces
- Changing capitalization
- Replacing inconsistent values
- All of the above (correct)
You're combining a string field (Customer Name) and an integer field (Customer ID). What type of calculation do you need to perform?
You're combining a string field (Customer Name) and an integer field (Customer ID). What type of calculation do you need to perform?
You want to find the ratio of total profits divided by the total sales. What should you do?
You want to find the ratio of total profits divided by the total sales. What should you do?
Which of the following is NOT a component of a calculation (formula) in Tableau?
Which of the following is NOT a component of a calculation (formula) in Tableau?
In Tableau calculations, how are fields typically represented?
In Tableau calculations, how are fields typically represented?
When are aggregation functions like SUM, AVG, and COUNT available for use in a calculated field?
When are aggregation functions like SUM, AVG, and COUNT available for use in a calculated field?
In a Tableau calculation, what is the purpose of 'Parameters'?
In a Tableau calculation, what is the purpose of 'Parameters'?
What is the purpose of adding 'Comments' in calculated fields?
What is the purpose of adding 'Comments' in calculated fields?
In Tableau, what is the key difference between clicking 'Apply' and 'OK' when creating a calculated field?
In Tableau, what is the key difference between clicking 'Apply' and 'OK' when creating a calculated field?
In Tableau, which function is used to extract a specific number of characters from the left side of a string?
In Tableau, which function is used to extract a specific number of characters from the left side of a string?
What will LEFT([Postal Code], 2)
return if the postal code is "98103"?
What will LEFT([Postal Code], 2)
return if the postal code is "98103"?
Which function is used to divide a string into substrings based on a specified delimiter?
Which function is used to divide a string into substrings based on a specified delimiter?
What result will SPLIT([Phone], “-”, 2)
produce if the [Phone] field contains "206-633-3400"?
What result will SPLIT([Phone], “-”, 2)
produce if the [Phone] field contains "206-633-3400"?
Which function checks if a string contains a specified substring?
Which function checks if a string contains a specified substring?
What is the purpose of the REPLACE()
function in Tableau?
What is the purpose of the REPLACE()
function in Tableau?
Which functions can be used to change the capitalization of a string field in Tableau?
Which functions can be used to change the capitalization of a string field in Tableau?
Which function removes leading and trailing spaces from a string?
Which function removes leading and trailing spaces from a string?
When using a date function in Tableau, how should the date_part
argument be formatted?
When using a date function in Tableau, how should the date_part
argument be formatted?
Which function returns a specific part of a given date as a number?
Which function returns a specific part of a given date as a number?
Which function returns a specific part of a given date as a string?
Which function returns a specific part of a given date as a string?
Which function is used to add a specified increment to a given date?
Which function is used to add a specified increment to a given date?
You need to calculate the difference in days between an order date and a ship date. Which function should you use?
You need to calculate the difference in days between an order date and a ship date. Which function should you use?
Which function truncates a date to the level of the specified date part?
Which function truncates a date to the level of the specified date part?
You want a field that displays January 1, 2021, given that the original date is January 23, 2021. Which function can be used to derive this?
You want a field that displays January 1, 2021, given that the original date is January 23, 2021. Which function can be used to derive this?
When calculating 'Time to Ship' using the DATEDIFF
function, what should be the first argument?
When calculating 'Time to Ship' using the DATEDIFF
function, what should be the first argument?
In Tableau, what is a Table Calculation?
In Tableau, what is a Table Calculation?
Which of the following computations are pre-defined 'Quick Table Calculations' in Tableau?
Which of the following computations are pre-defined 'Quick Table Calculations' in Tableau?
After applying a Table Calculation in Tableau, how can you identify that a field has a table calculation applied?
After applying a Table Calculation in Tableau, how can you identify that a field has a table calculation applied?
What is a common issue with real-world datasets that can be addressed using calculated fields in Tableau?
What is a common issue with real-world datasets that can be addressed using calculated fields in Tableau?
Why is it important to convert nulls to zeros when comparing quotas and sales?
Why is it important to convert nulls to zeros when comparing quotas and sales?
Which function returns a zero wherever there is a null value?
Which function returns a zero wherever there is a null value?
What is the final step suggested to enhance the visualization of sales quotas and corrected quotas?
What is the final step suggested to enhance the visualization of sales quotas and corrected quotas?
How do you create a calculated field for cost, defined as sales minus profit?
How do you create a calculated field for cost, defined as sales minus profit?
What is the main difference between Operators and Functions?
What is the main difference between Operators and Functions?
When performing a date calculation using DATENAME
, what data type does this function return?
When performing a date calculation using DATENAME
, what data type does this function return?
You're trying to determine a product's category based on its ID. The IDs are structured as [Category]-[Other Information]
. For instance, TEC-1234
indicates the 'Technology' category. Which formula will accurately extract the category?
You're trying to determine a product's category based on its ID. The IDs are structured as [Category]-[Other Information]
. For instance, TEC-1234
indicates the 'Technology' category. Which formula will accurately extract the category?
If you have a dataset with missing sales quota values, what is the primary reason for converting these Null
values to zero when comparing sales performance against quotas?
If you have a dataset with missing sales quota values, what is the primary reason for converting these Null
values to zero when comparing sales performance against quotas?
You've used a table calculation in Tableau. How can you quickly identify a field that has a table calculation applied to it?
You've used a table calculation in Tableau. How can you quickly identify a field that has a table calculation applied to it?
You are given a dataset with 'Product Names' that contain inconsistent use of ampersands ('&') instead of the word 'and'. What's the most efficient way to replace all instances of '&' with 'and' across the entire 'Product Name' field?
You are given a dataset with 'Product Names' that contain inconsistent use of ampersands ('&') instead of the word 'and'. What's the most efficient way to replace all instances of '&' with 'and' across the entire 'Product Name' field?
Flashcards
Calculated field use case?
Calculated field use case?
Used to calculate GDP per capita by calculating a ratio of GDP and Population.
What does a calculation in Tableau include?
What does a calculation in Tableau include?
A calculation, also known as a formula, includes fields, functions, operators and parameters.
What do calculated fields bring in?
What do calculated fields bring in?
Calculated fields bring in existing fields in your data, including data source fields and any calculated fields you built previously.
What are functions?
What are functions?
Signup and view all the flashcards
What are operators?
What are operators?
Signup and view all the flashcards
What are parameters?.
What are parameters?.
Signup and view all the flashcards
What are comments?
What are comments?
Signup and view all the flashcards
Difference between Apply and OK?
Difference between Apply and OK?
Signup and view all the flashcards
What is a Table Calculation?
What is a Table Calculation?
Signup and view all the flashcards
What does the DATEPART function do?
What does the DATEPART function do?
Signup and view all the flashcards
What does the DATENAME function do?
What does the DATENAME function do?
Signup and view all the flashcards
What does the DATEADD function do?
What does the DATEADD function do?
Signup and view all the flashcards
What does the DATEDIFF function do?
What does the DATEDIFF function do?
Signup and view all the flashcards
What does the DATETRUNC function do?
What does the DATETRUNC function do?
Signup and view all the flashcards
What do the LEFT and RIGHT string functions do?
What do the LEFT and RIGHT string functions do?
Signup and view all the flashcards
What does the SPLIT string function do?
What does the SPLIT string function do?
Signup and view all the flashcards
What does the CONTAINS string function do?
What does the CONTAINS string function do?
Signup and view all the flashcards
What does the REPLACE string function do?
What does the REPLACE string function do?
Signup and view all the flashcards
What do the UPPER and LOWER string functions do?
What do the UPPER and LOWER string functions do?
Signup and view all the flashcards
What does the TRIM function do?
What does the TRIM function do?
Signup and view all the flashcards
What does the ZN function do?
What does the ZN function do?
Signup and view all the flashcards
Study Notes
Calculated Fields in Tableau
- Calculated fields are used in various scenarios like calculating GDP per capita.
- The GDP per capita calculation involves dividing the sum of GDP by the sum of the population: SUM([GDP])/SUM([Population]).
- Calculated fields enable creation of new fields from existing ones, like deriving net cost from Sales and Profit fields.
- String values can be formatted using calculated fields to clean data by trimming spaces, changing capitalization, or replacing inconsistent values.
- Calculations can change a field's data type to work with others, such as combining a string field (Customer Name) with an integer field (Customer ID).
- Manipulation of date fields is possible, allowing for extraction of specific parts of a date or calculation of time between two dates.
- It's possible to control how data is aggregated in a calculation, like calculating the ratio of total profits to total sales.
- A calculation includes fields, functions, operators, and parameters: SUM([GDP]) / SUM([Population]) + [Parameter].
- Fields in calculations are existing data fields and any previously built calculated fields, enclosed in square brackets and shown in orange (e.g., [GDP], [Population]).
- Functions are operations performed on data depending on its type, such as aggregation functions (AVG, SUM, COUNT). Functions are blue and followed by parentheses.
- Operators are shortcuts for complex functions (+, -, *, /, %, ==, >, <). They are dark gray. The first operator is /.
- Parameters are placeholders for constant values, shown in purple and enclosed in square brackets.
- Comments are annotations for calculations, displayed in light gray and starting with two forward slashes (//).
- Clicking Apply allows you to preview how the calculation changes the data in the view, while clicking OK saves the calculation.
- You can create a simple profit visualization by placing Profit to Columns, and Market and Subcategory to Rows, and filtering Category to just Furniture.
- It is possible to have one distinct color for positive and negative numbers.
- Calculated fields can be created by defining a formula via Analysis > Create Calculated Field.
- The formula for positive/negative emphasis could be: IF SUM([Profit]) > 0 THEN "positive" ELSE "negative" END.
- Name the calculated field "sign of profit" and add a comment in code with //.
- An equal sign in front of the field indicates it’s a calculated field and not directly from the data source.
String Functions
- LEFT(string, number) and RIGHT(string, number) return the leftmost or rightmost characters.
- SPLIT(string, delimiter, token number) divides a string into substrings based on a delimiter.
- CONTAINS(string, substring) returns true if a string contains a specified substring.
- REPLACE(string, substring, replacement) finds a substring within a string and replaces it.
- UPPER(string) and LOWER(string) convert a string to uppercase or lowercase.
- TRIM(string) removes leading and trailing spaces.
Date Functions in Tableau
- When using a
date_part
argument in a date function, it must be singular, all lowercase, and wrapped in single quotation marks (ex: 'month'). - Relevant date functions:
- DATEPART(date_part, date, [start_of_week]): Returns the specified part of a given date as a number. For example, DATEPART('month', #January 23, 2021#) = 1.
- DATENAME(date_part, date, [start_of_week]): Similar to DATEPART but returns the date part as a string. For example, DATENAME('month', #January 23, 2021#) = January.
- DATEADD(date_part, increment, date): Returns a date with a specified increment added. For example, DATEADD('day', 7, #January 23, 2021#) = January 30, 2021.
- DATEDIFF(date_part, start_date, end_date, [start_of_week]): Returns the difference between two dates using the specified date part. For example, DATEDIFF('day', #January 23, 2021#, #February 24, 2021#) = 32.
- DATETRUNC(date_part, date, [start_of_week]): Truncates a date to the level of the specified date_part. This function returns a new date. DATETRUNC('month', #January 23, 2021#) returns January 1, 2021.
- To calculate the time it takes for an order to ship:
- Create a calculated field named "Time to Ship.".
- Use the DATEDIFF function: DATEDIFF('day', [Order Date], [Ship Date]).
- Ensure the calculation is valid before clicking OK.
Introduction to Table Calculations
- Table calculations are secondary calculations performed on a returned result set.
- Tableau has pre-defined, commonly used computations called Quick Table Calculations that include: Running Total, Percent of Total, and Year over Year Growth.
- Create a new sheet, put Category to Columns and Sales to Rows. Then move Order Date to Columns, expand to Quarters. Put Sales to Rows again
- You can select the Running Total Quick Table Calculation from the dropdown men.
- Can drag your Table Calc to the right axis for a dual axis chart then right click and synchronize the axis.
- Table calculations are indicated by a delta symbol in the pill.
Data Validation - Nulls to Zeroes
- Calculations can remove null values.
- Convert nulls to zeros to be able to generate a comparison.
- To convert nulls to zeros:
- Right-click in the data window and select create calculated field.
- Name it "Corrected Quota".
- Use the ZN( function: ZN([Quota])
- The ZN function returns zero wherever there is a null.
- Visualizations need to be fixed by right clicking in the map and viewing the data.
- Use SUM(Sales)-SUM(Corrected Quota) to view data in visualization.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.