Calculated Fields

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

What benefit do calculated fields provide in data analysis?

  • They enable the creation of new fields from existing data. (correct)
  • They replace the need for manual data entry.
  • They allow modification of the underlying data source directly.
  • They automatically optimize data storage within the system.

In the context of calculated fields, what does GDP represent?

  • Government Debt Percentage, indicating a country's financial obligations.
  • Gross Domestic Product, representing total spending in an economy. (correct)
  • General Data Protection, guidelines regarding data privacy.
  • Geographic Data Points, representing location-based data for analysis.

When creating a 'GDP per capita' calculated field, which calculation is typically performed?

  • Multiplying GDP by Population.
  • Adding GDP and Population together.
  • Calculating the ratio of GDP to Population. (correct)
  • Subtracting Population from GDP.

Which of the following actions can be accomplished using calculated fields?

<p>Creating new fields from existing ones. (A)</p> Signup and view all the answers

How can a calculated field be used to reformat text data?

<p>By employing string functions to modify string values. (C)</p> Signup and view all the answers

What is the purpose of changing a field's data type within a calculated field?

<p>To ensure compatibility with other fields for calculations. (A)</p> Signup and view all the answers

What type of data is primarily manipulated when using date fields in calculated fields?

<p>Temporal data for time-based analyses. (D)</p> Signup and view all the answers

Why is it important to control how data is aggregated in a calculation?

<p>To achieve accurate and meaningful analytical results. (B)</p> Signup and view all the answers

Besides fields, what other elements are used in calculated fields?

<p>Functions, operators, and parameters. (D)</p> Signup and view all the answers

In the context of calculated fields, what is the primary role of 'Functions'?

<p>To perform specific actions or computations on the data. (D)</p> Signup and view all the answers

What role do Operators play within calculated fields?

<p>They define the sequence in which calculations are performed. (D)</p> Signup and view all the answers

How do 'Parameters' enhance the functionality of calculated fields?

<p>By allowing dynamic, user-controlled inputs that adjust calculations. (C)</p> Signup and view all the answers

How is the calculation editor typically accessed to create calculated fields?

<p>By selecting 'Create Calculated Field' from the Data pane or Analysis menu. (D)</p> Signup and view all the answers

Within the calculation editor, what is the purpose of clicking 'Apply'?

<p>To preview how the calculation changes the data in the view. (C)</p> Signup and view all the answers

Regarding the calculation editor, what action does clicking 'OK' perform?

<p>It saves the calculation and closes the editor window. (B)</p> Signup and view all the answers

What is an 'Ad-hoc' calculation?

<p>A calculation performed directly without formally opening the calculation editor. (D)</p> Signup and view all the answers

In the context of ad-hoc calculations, how are fields typically added into a function?

<p>By dragging the field into the parenthesis after the function. (C)</p> Signup and view all the answers

What is the function of the LEFT string function?

<p>It returns the leftmost characters of a string. (D)</p> Signup and view all the answers

What does the SPLIT string function do?

<p>Divides a string into substrings based on a delimiter. (A)</p> Signup and view all the answers

What is the purpose of the CONTAINS string function?

<p>To check if a string contains a specified substring. (D)</p> Signup and view all the answers

What operation does the REPLACE string function perform?

<p>It substitutes a substring with another string in a given text. (C)</p> Signup and view all the answers

What is the effect of the UPPER and LOWER string functions?

<p>They modify the string to uppercase or lowercase. (B)</p> Signup and view all the answers

When using a date_part argument in a date function, what formatting is required?

<p>It must be singular, all lowercase, and wrapped in single quotation marks. (A)</p> Signup and view all the answers

What values does DATEPART return?

<p>Returns part of a given date as a number. (B)</p> Signup and view all the answers

If DATEPART returns a number, what does DATENAME return?

<p>Returns part of a given date as a string. (A)</p> Signup and view all the answers

What does the DATEADD function do?

<p>Returns a date in which the specified increment has been added to the given date. (C)</p> Signup and view all the answers

The DATETRUNC function truncates or “rounds down” the given date to the level of the specified date_part, what does this function return?

<p>Returns a new date. (A)</p> Signup and view all the answers

Flashcards

Calculated Fields

New fields derived from existing data for deeper analysis.

GDP

Gross Domestic Product, total spending by consumers, businesses and government.

Population

The total number of people living in an area.

GDP per capita

GDP divided by the population, indicating average economic output per person.

Signup and view all the flashcards

Calculated fields usage

Combine existing fields to make new ones

Signup and view all the flashcards

Format string values

Adjust text appearance in data.

Signup and view all the flashcards

Change Data Type

Changing data type for operations.

Signup and view all the flashcards

Manipulate date fields

Adjust or modify date information.

Signup and view all the flashcards

Control Data Aggregation

Modify calculation based on data aggregation.

Signup and view all the flashcards

Calculated fields

Using fields, functions, operators and parameters to perform calculations.

Signup and view all the flashcards

Calculation editor

Tool to build a calculated field.

Signup and view all the flashcards

Apply button

See how a calculation changes the view.

Signup and view all the flashcards

OK button

Saves your changes to the calculated field.

Signup and view all the flashcards

Ad-hoc calculation

Directly enter calculations.

Signup and view all the flashcards

LEFT/RIGHT functions

Extracts characters from the left/right a string.

Signup and view all the flashcards

SPLIT function

Divide a string into parts using a delimiter.

Signup and view all the flashcards

CONTAINS function

Checks if one string contains another.

Signup and view all the flashcards

REPLACE Function

Replace part of a string with another.

Signup and view all the flashcards

UPPER/LOWER functions

Convert text to upper or lowercase.

Signup and view all the flashcards

TRIM function

Removes extra spaced from the start and end of a text.

Signup and view all the flashcards

Date Part

Specific element of a date.

Signup and view all the flashcards

DATEPART function

Extracts element from date as a number.

Signup and view all the flashcards

DATENAME function

Extracts element from date as a string.

Signup and view all the flashcards

DATEADD function

Adds increment to a date.

Signup and view all the flashcards

DATEDIFF function

Difference betweeen two dates.

Signup and view all the flashcards

DATETRUNC function

Reduces a date to specified precision.

Signup and view all the flashcards

Aggregate functions

Combine numbers for summations, averages and medians.

Signup and view all the flashcards

Mathematical Order of Operations

Established order for performing mathematical operations.

Signup and view all the flashcards

Level of Detail expression

Summarize data at pre-defined level.

Signup and view all the flashcards

INCLUDE

Modify calculations by making them more detailed.

Signup and view all the flashcards

Study Notes

  • Calculated fields allow new fields to be created from data that already exists in a data source.

Scenarios for Using Calculated Fields

  • GDP, or Gross Domestic Product, is all of the money spent by consumers, businesses, and governments.
  • Population represents total population.
  • A new calculated field that determined GDP per capita can be created by calculating a ratio of GDP and Population using formula SUM([GDP])/SUM([Population]).

Calculated Fields Capabilities

  • New fields can be created using existing ones
  • String values can be formatted
  • A field's data type can be changed to work with others
  • Date fields can be manipulated
  • How data is aggregated in a calculation can be controlled
  • Calculated fields consist of: Fields, Functions, Operators, and Parameters.
  • SUM([GDP]) / SUM([Population]) + [Parameter] calculates GDP per capita.

Creating Calculated Fields

  • To create calculated fields, use the calculation editor.
  • To open the editor, select Create Calculated Field from the Data pane or from the Analysis menu.
  • Clicking Apply allows one to preview how the calculation changes the data in the view.
  • Clicking OK saves the calculation.

Ad-hoc Calculations

  • Type the operator, the first few letters of the function, and the first few letters of the field name into the calculation.
  • Fields can be dragged into the parenthesis after the function.

String Functions

  • LEFT(string, number) will show the leftmost number of characters within a string
  • RIGHT(string, number) will show the rightmost number of characters within a string
  • SPLIT(string, delimiter, token number) returns a substring from a string, using a delimiter to divide the string into substrings and then using the token to determine which substring to return.
  • CONTAINS(string, substring) returns true if the given string contains the specified substring; otherwise returns false.
  • REPLACE(string, substring, replacement) searches string for substring and replaces it with replacement, if substring is not found, the string is not changed.
  • UPPER(string) updates the string to uppercase characters.
  • LOWER(string) updates the string to lowercase characters.
  • TRIM(string) returns the string with leading and trailing spaces removed.

Date Parts

  • When using a date_part argument in a date function, note that it must be singular, all lowercase, and wrapped in single quotation marks, like: 'month', not 'months', 'Month', or 'MONTH'.

Date Functions

  • DATEPART (date_part, date, [start_of_week]) returns part of a given date as a number.
  • DATENAME (date_part, date, [start_of_week]) is similar to DATEPART, but it returns part of a given date as a string.
  • DATEADD (date_part, increment, date) returns a date in which the specified increment has been added to the given date.
  • DATEDIFF (date_part, start_date, end_date, [start_of_week]) returns the difference between the two dates using the specified date part.
  • DATETRUNC (date_part, date, [start_of_week]) truncates or “rounds down” the given date to the level of the specified date_part and returns a new date.

Scenarios using Dates

  • When working with product shipping data with order dates and ship dates, but without calculating the number of days between them, you can show the average number of days between the order and ship dates for product sub-categories, organized by product category with a date calculation and adjust the aggregation type.

Aggregate Functions

  • SUM, AVG, and MEDIAN are common aggregate functions.

Mathematical Order of Operations

  • The mathematical order of operations provides a convention for how mathematical expressions are interpreted and solved in the following order: Elements within parentheses, Exponents, Division and multiplication, Addition and subtraction.

Using Aggregate Functions

  • Aggregate functions can be used in calculations such asSUM([Marketing Expenses])/SUM([Sales])

Usage Examples

  • When a data contains fields for Profit and Sales of a company's products and the goal is to find the profit ratios for each year, broken down by Category, a Profit Ratio field can be created via a calculated field.

Level of Detail Expressions

  • When a chart/graph is created in Tableau, its level of detail can be decided by adding categories ("dimensions") to Rows, Columns, or the "Marks card."
  • More categories = more detailed chart.
  • Level of detail (LOD) refers to the aggregation or granularity of the data.
  • LOD expressions determine the levels of detail used in a calculation without actually dropping dimensions into the visualization.
  • The level of detail at which a calculation should be performed independently of the level of detail can be defined.
  • LOD uses keywords to perform calculations at a more granular level (INCLUDE), a less granular level (EXCLUDE), or an entirely independent level (FIXED).
  • "INCLUDE" makes the calculation more detailed by considering more categories.
  • "EXCLUDE" makes the calculation less detailed by ignoring some categories.
  • "FIXED" lets one set a specific detail level that doesn't change, no matter what's in the chart.
  • FIXED computes a value using the specified dimensions, without reference to the dimensions in the view.
  • {FIXED [Region] : SUM([Sales])} expression computes the sum of sales per region.
  • FIXED calculation can be used to show the average profit by product and create a dual axis chart that compares these values to average sales.

Table Calculations

  • Table calculations are calculated fields applied to the values of a measure in a visualization.
  • They compute the local data to transform the values based on what is currently in the view.
  • Can be used for: Transforming values to show rankings, running totals, and/or percent of total.
  • Quick Table Calculation can be used to apply one of these calculations, click the drop-down menu on a measure field in your view, point to Quick Table Calculation, and then click the desired calculation type.

Quick Table Calculations

  • Running Total - Adds totals across the table.
  • Difference - Calculates the difference from the previous column, across a table.
  • Percent Difference - Calculates the percent difference from the previous column, across a table.
  • Percent of Total - Computes a value as a percentage of all values within the table structure, across a table.
  • Rank - Calculates the integer rank of the value across the table.
  • Percentile - Calculates the statistical percentile of the value across the table.
  • Moving Average - Calculates the average value based on a range around the current value, smoothing short-term fluctuations.
  • YTD Total - Year-to-date total calculates the running total from the beginning of the year across the table.
  • YTD Growth - Year-to-date growth calculates a percentage change from the same time period in the previous year and then calculates a running total over a year.
  • Compound Growth Rate - Calculates the current value as a percentage from the first value.
  • Year Over Year Growth - Calculates a percentage for the current value compared to the same period in the previous year.
  • EX: creating a bar chart by calculating the percentage of annual change in sales of tables using a quick table calculation to explore these fluctuations.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

More Like This

Excel Formatting and Functions Quiz
41 questions
SQL Lecture Notes I
13 questions

SQL Lecture Notes I

AuthoritativeLight4923 avatar
AuthoritativeLight4923
Tableau: Calculated Fields
41 questions

Tableau: Calculated Fields

WondrousNewOrleans avatar
WondrousNewOrleans
Use Quizgecko on...
Browser
Browser