Plan and Implement Calculations in Tableau Desktop - 38% Flashcards
what is fixed LOD and when to use
This expression computes values using the specified dimensions without reference to any other dimensions in the view.
use when: aggregates the value only at the dimensions which are specified by the user in the calculation
what is include LOD and when to use
This level of detail expressions compute values using the specified dimensions in addition to whatever dimensions are in the view.
use when a user wants to calculate values at the lower level of granularity and then aggregate and show the values at the higher level of granularity
what is exclude LOD and when to use
These levels of detail expressions subtract dimensions from the view level of detail.
use when you want to omit specified dimensions from the aggregations
although in the view we are going to show only “Segment” in calculations we need to include “Customer Name” as well so that average customer sales can be calculated.
what are LOD expressions
used to run complex queries involving many dimensions at the data source level instead of bringing all the data to Tableau interface
example of INCLUDE
compare the average customer sales across different product segments
example of EXCLUDE
compare total sales with the monthly sales of the East region
To get the monthly sales we need to have “Region”, “Month” and “Sum of Sales” in the view. But, now to get the total sales of Region, we need to exclude “Month” in the calculation so that we can have total sales value for the region.
example of FIXED
calculates the sales across regions
even if a user puts another field say “State” in the view, the fixed calculation still calculates the value at region level only
ABS
returns the absolute value of the specified number.
Example: ABS(-10) = 10
CEILING
rounds the given number to the nearest integer of equal or greater value.
Example: CEILING(5.1265) = 6
FLOOR
rounds the given number to the nearest integer of equal or lesser value
Example: FLOOR(5.1265) = 5
LOG
returns the logarithm value of the number for the given base. If the base value is omitted, base 10 is being used by default
Example: LOG(100) = 2, LOG(256,2) = 8
MIN
Returns the minimum value of an expression across all records
Example: MIN([Profit])
This expression will return the minimum value of the profit across all the profit values
MAX
Returns the maximum value of an expression across all records
Example: MAX([Profit])
This expression will return the maximum value of the profit across all the profit values
POWER
It returns the result of a number raised to the given power
Example: POWER(5,2) = 25
SQRT
It returns the square root of a given number
Example: SQRT(25) = 5
ZN
“ZN” stands for “Zero if Null”. It means it returns the given expression if it is not null, otherwise returns zero.
CONTAINS
returns “True” if the user’s mentioned sub-string is present in the given string.
Example: CONTAINS(“University”, “versi”) = True
ENDSWITH
It returns “True” if the given string ends with the user’s mentioned sub-string
Example: ENDSWITH(“University”, “sity”) = True
FIND
returns the position of the mentioned sub-string within the given string. If the sub-string isn’t found then it returns 0(zero)
Example: FIND(“University”, “versi”) = 4
ISDATE
used to check whether the given string is a valid date. If the string is valid date then it returns “True”
Example: ISDATE(“2017-05-12”) = True
LEFT
returns the specified number of characters from the start of the string
Example: LEFT(“Calculation”, 4) = Calc
LEN
returns the number of characters in the given string.
Example: LEN(“Calculation”) = 11
LOWER
Convert a text string to all lowercase letters
Example: LOWER(“CalCulation”) = calculation
MID
It returns the characters from the middle of a text string given a starting position and length.
Example: MID(“Tableau”,2,4) = able
REPLACE
returns a string in which every occurrence of the substring is replaced with the replacement string.
Example: REPLACE(“Calculation”, “ion”, “ed”) = Calculated
RIGHT
returns the specified number of characters from the end of the given string
Example: RIGHT(“Calculation”, 4) = tion
TRIM
Returns the string with both trailing and leading spaces removed
Example: TRIM(“ Budget “) = Budget
UPPER
Convert a text string to all uppercase letters
Example: LOWER(“Budget”) = BUDGET
DATEADD
Add an increment to the specified date and returns the new date.
Example: DATEADD(‘month’, 3, #2017-07-12#) = 2017-10-12 12:00:00 AM
DATEDIFF
Returns the difference the two dates where start_date is subtracted from end_date
Example: DATEDIFF(‘month’, #2017-04-12#, #2017-07-15#) = 3
DATENAME
Returns the part of the given date as string.
Example: DATENAME(‘month’, #2017-05-14#) = May