id
stringlengths
8
78
source
stringclasses
743 values
chunk_id
int64
1
5.05k
text
stringlengths
593
49.7k
amazon-quicksight-user-093
amazon-quicksight-user.pdf
93
on a conditional statement. • distinct_count calculates the number of distinct values in a dimension or measure, grouped by the chosen dimension or dimensions. • distinct_countIf calculates the distinct count based on a conditional statement. • max returns the maximum value of the specified measure, grouped by the chosen dimension or dimensions. • maxIf calculates the maximum based on a conditional statement. • median returns the median value of the specified measure, grouped by the chosen dimension or dimensions. • medianIf calculates the median based on a conditional statement. • min returns the minimum value of the specified measure, grouped by the chosen dimension or dimensions. • minIf calculates the minimum based on a conditional statement. • percentile (alias of percentileDisc) computes the nth percentile of the specified measure, grouped by the chosen dimension or dimensions. Functions and operators 282 Amazon QuickSight User Guide • percentileCont calculates the nth percentile based on a continuous distribution of the numbers of the specified measure, grouped by the chosen dimension or dimensions. • percentileDisc (percentile) calculates the nth percentile based on the actual numbers of the specified measure, grouped by the chosen dimension or dimensions. • periodToDateAvg averages the set of numbers in the specified measure for a given time granularity (for instance, a quarter) up to a point in time. • periodToDateCount calculates the number of values in a dimension or measure for a given time granularity (for instance, Quarter) up to a point in time including duplicates. • periodToDateMax returns the maximum value of the specified measure for a given time granularity (for instance, a quarter) up to a point in time. • periodToDateMedian returns the median value of the specified measure for a given time granularity (for instance, a quarter) up to a point in time. • periodToDateMin returns the minimum value of the specified measure or date for a given time granularity (for instance, a quarter) up to a point in time. • periodToDatePercentile calculates the percentile based on the actual numbers in measure for a given time granularity (for instance, a quarter) up to a point in time. • periodToDatePercentileCont calculates percentile based on a continuous distribution of the numbers in the measure for a given time granularity (for instance, a quarter) up to a point in time. • periodToDateStDev calculates the standard deviation of the set of numbers in the specified measure for a given time granularity (for instance, a quarter) up to a point in time based on a sample. • periodToDateStDevP calculates the population standard deviation of the set of numbers in the specified measure for a given time granularity (for instance, a quarter) up to a point in time based on a sample. • periodToDateSum adds the set of numbers in the specified measure for a given time granularity (for instance, a quarter) up to a point in time. • periodToDateVar calculates the sample variance of the set of numbers in the specified measure for a given time granularity (for instance, a quarter) up to a point in time. • periodToDateVarP calculates the population variance of the set of numbers in the specified measure for a given time granularity (for instance, a quarter) up to a point in time. • stdev) calculates the standard deviation of the set of numbers in the specified measure, grouped by the chosen dimension or dimensions, based on a sample. Functions and operators 283 Amazon QuickSight User Guide • stdevIf calculates the sample standard deviation based on a conditional statement. • stdevp calculates the standard deviation of the set of numbers in the specified measure, grouped by the chosen dimension or dimensions, based on a biased population. • stdevpIf calculates the population deviation based on a conditional statement. • var) calculates the variance of the set of numbers in the specified measure, grouped by the chosen dimension or dimensions, based on a sample. • varIf calculates the sample variance based on a conditional statement. • varp) calculates the variance of the set of numbers in the specified measure, grouped by the chosen dimension or dimensions, based on a biased population. • varpIf calculates the population variance based on a conditional statement. • sum) adds the set of numbers in the specified measure, grouped by the chosen dimension or dimensions. • sumIf) calculates the sum based on a conditional statement. Conditional functions The conditional functions for calculated fields in Amazon QuickSight include the following: • Coalesce returns the value of the first argument that is not null. • Ifelse evaluates a set of if, then expression pairings, and returns the value of the then argument for the first if argument that evaluates to true. • in evaluates an expression to see if it is in a given list of values. • isNotNull evaluates an expression to see if it is
amazon-quicksight-user-094
amazon-quicksight-user.pdf
94
the specified measure, grouped by the chosen dimension or dimensions. • sumIf) calculates the sum based on a conditional statement. Conditional functions The conditional functions for calculated fields in Amazon QuickSight include the following: • Coalesce returns the value of the first argument that is not null. • Ifelse evaluates a set of if, then expression pairings, and returns the value of the then argument for the first if argument that evaluates to true. • in evaluates an expression to see if it is in a given list of values. • isNotNull evaluates an expression to see if it is not null. • isNull evaluates an expression to see if it is null. If the expression is null, isNull returns true, and otherwise it returns false. • notIn evaluates an expression to see if it is not in a given list of values. • nullIf compares two expressions. If they are equal, the function returns null. If they are not equal, the function returns the first expression. • switch returns an expression that matches the first label equal to the condition expression. Date functions The date functions for calculated fields in Amazon QuickSight include the following: Functions and operators 284 Amazon QuickSight User Guide • addDateTime adds or subtracts a unit of time to the date or time provided. • addWorkDays adds or subtracts the given number of work days to the date or time provided. • dateDiff returns the difference in days between two date fields. • epochDate converts an epoch date into a standard date. • Extract returns a specified portion of a date value. • formatDate formats a date using a pattern you specify. • isWorkDay returns TRUE if a given date-time value is a work or business day. • netWorkDays returns the number of working days between the provided two date values. • Now returns the current date and time, using either settings for a database, or UTC for file and Salesforce. • truncDate returns a date value that represents a specified portion of a date. Numeric functions The numeric functions for calculated fields in Amazon QuickSight include the following: • Ceil rounds a decimal value to the next highest integer. • decimalToInt converts a decimal value to an integer. • Floor decrements a decimal value to the next lowest integer. • intToDecimal converts an integer value to a decimal. • Round rounds a decimal value to the closest integer or, if scale is specified, to the closest decimal place. Mathematical functions The mathematical functions for calculated fields in Amazon QuickSight include the following: • Mod(number, divisor) – Finds the remainder after dividing a number by a divisor. • Log(expression) – Returns the base 10 logarithm of a given expression. • Ln(expression) – Returns the natural logarithm of a given expression. • Abs(expression) – Returns the absolute value of a given expression. • Sqrt(expression) – Returns the square root of a given expression. • Exp(expression) – Returns the base of natural log e raised to the power of a given expression. Functions and operators 285 Amazon QuickSight String functions User Guide The string (text) functions for calculated fields in Amazon QuickSight include the following: • Concat concatenates two or more strings. • contains checks if an expression contains a substring. • endsWith checks if the expression ends with the substring specified. • Left returns the specified number of leftmost characters from a string. • Locate locates a substring within another string, and returns the number of characters before the substring. • Ltrim removes preceding blank space from a string. • parseDate parses a string to determine if it contains a date value, and returns the date if found. • parseDecimal parses a string to determine if it contains a decimal value. • parseInt parses a string to determine if it contains an integer value. • parseJson parses values from a native JSON or from a JSON object in a text field. • Replace replaces part of a string with a new string. • Right returns the specified number of rightmost characters from a string. • Rtrim removes following blank space from a string. • Split splits a string into an array of substrings, based on a delimiter that you choose, and returns the item specified by the position. • startsWith checks if the expression starts with the substring specified. • Strlen returns the number of characters in a string. • Substring returns the specified number of characters in a string, starting at the specified location. • toLower formats a string in all lowercase. • toString formats the input expression as a string. • toUpper formats a string in all uppercase. • trim removes both preceding and following blank space from a string. Table calculations Table calculations form a group of functions that provide context in an
amazon-quicksight-user-095
amazon-quicksight-user.pdf
95
delimiter that you choose, and returns the item specified by the position. • startsWith checks if the expression starts with the substring specified. • Strlen returns the number of characters in a string. • Substring returns the specified number of characters in a string, starting at the specified location. • toLower formats a string in all lowercase. • toString formats the input expression as a string. • toUpper formats a string in all uppercase. • trim removes both preceding and following blank space from a string. Table calculations Table calculations form a group of functions that provide context in an analysis. They provide support for enriched aggregated analysis. By using these calculations, you can address common Functions and operators 286 Amazon QuickSight User Guide business scenarios such as calculating percentage of total, running sum, difference, common baseline, and rank. When you are analyzing data in a specific visual, you can apply table calculations to the current set of data to discover how dimensions influence measures or each other. Visualized data is your result set based on your current dataset, with all the filters, field selections, and customizations applied. To see exactly what this result set is, you can export your visual to a file. A table calculation function performs operations on the data to reveal relationships between fields. Lookup-based functions • difference calculates the difference between a measure based on one set of partitions and sorts, and a measure based on another. • lag calculates the lag (previous) value for a measure. • lead calculates the lead (following) value for a measure. • percentDifference calculates the percentage difference between the current value and a comparison value. Over functions • avgOver calculates the average of a measure over one or more dimensions. • countOver calculates the count of a field over one or more dimensions. • distinctCountOver calculates the distinct count of the operand partitioned by the specified attributes at a specified level. • maxOver calculates the maximum of a measure over one or more dimensions. • minOver the minimum of a measure over one or more dimensions. • percentileOver (alias of percentileDiscOver) calculates the nth percentile of a measure partitioned by a list of dimensions. • percentileContOver calculates the nth percentile based on a continuous distribution of the numbers of a measure partitioned by a list of dimensions. • percentileDiscOver calculates the nth percentile based on the actual numbers of a measure partitioned by a list of dimensions. • percentOfTotal calculates the percentage that a measure contributes to the total. • periodOverPeriodDifference calculates the difference of a measure over two different time periods as specified by period granularity and offset. Functions and operators 287 Amazon QuickSight User Guide • periodOverPeriodLastValue calculates the last (previous) value of a measure from a previous time period as specified by period granularity and offset. • periodOverPeriodPercentDifference calculates the percent difference of a measure over two different time periods as specified by period granularity and offset. • periodToDateAvgOverTime calculates the average of a measure for a given time granularity (for instance, a quarter) up to a point in time. • periodToDateCountOverTime calculates the count of a dimension or measure for a given time granularity (for instance, a quarter) up to a point in time. • periodToDateMaxOverTime calculates the maximum of a measure or date for a given time granularity (for instance, a quarter) up to a point in time. • periodToDateMinOverTime calculates the minimum of a measure or date for a given time granularity (for instance, a quarter) up to a point in time. • periodToDateSumOverTime calculates the sum of a measure for a given time granularity (for instance, a quarter) up to a point in time. • sumOver calculates the sum of a measure over one or more dimensions. • stdevOver calculates the standard deviation of the specified measure, partitioned by the chosen attribute or attributes, based on a sample. • stdevpOver calculates the standard deviation of the specified measure, partitioned by the chosen attribute or attributes, based on a biased population. • varOver calculates the variance of the specified measure, partitioned by the chosen attribute or attributes, based on a sample. • varpOver calculates the variance of the specified measure, partitioned by the chosen attribute or attributes, based on a biased population. Ranking functions • rank calculates the rank of a measure or a dimension. • denseRank calculates the rank of a measure or a dimension, ignoring duplicates. • percentileRank calculates the rank of a measure or a dimension, based on percentile. Running functions • runningAvg calculates a running average for a measure. • runningCount calculates a running count for a measure. Functions and operators 288 Amazon QuickSight User Guide • runningMax calculates a running maximum for a measure. • runningMin calculates a running minimum for a measure. • runningSum calculates a running
amazon-quicksight-user-096
amazon-quicksight-user.pdf
96
chosen attribute or attributes, based on a biased population. Ranking functions • rank calculates the rank of a measure or a dimension. • denseRank calculates the rank of a measure or a dimension, ignoring duplicates. • percentileRank calculates the rank of a measure or a dimension, based on percentile. Running functions • runningAvg calculates a running average for a measure. • runningCount calculates a running count for a measure. Functions and operators 288 Amazon QuickSight User Guide • runningMax calculates a running maximum for a measure. • runningMin calculates a running minimum for a measure. • runningSum calculates a running sum for a measure. Window functions • firstValue calculates the first value of the aggregated measure or dimension partitioned and sorted by specified attributes. • lastValue calculates the last value of the aggregated measure or dimension partitioned and sorted by specified attributes. • windowAvg calculates the average of the aggregated measure in a custom window that is partitioned and sorted by specified attributes. • windowCount calculates the count of the aggregated measure in a custom window that is partitioned and sorted by specified attributes. • windowMax calculates the maximum of the aggregated measure in a custom window that is partitioned and sorted by specified attributes. • windowMin calculates the minimum of the aggregated measure in a custom window that is partitioned and sorted by specified attributes. • windowSum calculates the sum of the aggregated measure in a custom window that is partitioned and sorted by specified attributes. Functions In this section, you can find a list of functions available in Amazon QuickSight. To view a list of functions sorted by category, with brief definitions, see Functions by category. Topics • addDateTime • addWorkDays • Abs • Ceil • Coalesce • Concat • contains Functions and operators 289 Amazon QuickSight • decimalToInt • dateDiff • endsWith • epochDate • Exp • Extract • Floor • formatDate • Ifelse • in • intToDecimal • isNotNull • isNull • isWorkDay • Left • Locate • Log • Ln • Ltrim • Mod • netWorkDays • Now • notIn • nullIf • parseDate • parseDecimal • parseInt • parseJson • Replace Functions and operators User Guide 290 User Guide Amazon QuickSight • Right • Round • Rtrim • Split • Sqrt • startsWith • Strlen • Substring • switch • toLower • toString • toUpper • trim • truncDate addDateTime addDateTime adds or subtracts a unit of time from a datetime value. For example, addDateTime(2,'YYYY',parseDate('02-JUL-2018', 'dd-MMM-yyyy') ) returns 02- JUL-2020. You can use this function to perform date math on your date and time data. Syntax addDateTime(amount, period, datetime) Arguments amount A positive or negative integer value that represents the amount of time that you want to add or subtract from the provided datetime field. period A positive or negative value that represents the amount of time that you want to add or subtract from the provided datetime field. Valid periods are as follows: Functions and operators 291 Amazon QuickSight User Guide • YYYY: This returns the year portion of the date. • Q: This returns the quarter that the date belongs to (1–4). • MM: This returns the month portion of the date. • DD: This returns the day portion of the date. • WK: This returns the week portion of the date. The week starts on Sunday in Amazon QuickSight. • HH: This returns the hour portion of the date. • MI: This returns the minute portion of the date. • SS: This returns the second portion of the date. • MS: This returns the millisecond portion of the date. datetime The date or time that you want to perform date math on. Return type Datetime Example Let's say you have a field called purchase_date that has the following values. 2018 May 13 13:24 2017 Jan 31 23:06 2016 Dec 28 06:45 Using the following calculations, addDateTime modifies the values as shown following. addDateTime(-2, 'YYYY', purchaseDate) 2016 May 13 13:24 2015 Jan 31 23:06 2014 Dec 28 06:45 addDateTime(4, 'DD', purchaseDate) Functions and operators 292 User Guide Amazon QuickSight 2018 May 17 13:24 2017 Feb 4 23:06 2017 Jan 1 06:45 addDateTime(20, 'MI', purchaseDate) 2018 May 13 13:44 2017 Jan 31 23:26 2016 Dec 28 07:05 addWorkDays addWorkDays Adds or subtracts a designated number of work days to a given date value. The function returns a date for a work day, that falls a designated work days after or before a given input date value. Syntax addWorkDays(initDate, numWorkDays) Arguments initDate A valid non-NULL date that acts as the start date for the calculation. • Dataset field – Any date field from the dataset that you are adding this function to. • Date function – Any date output from another date function, for example parseDate, epochDate, addDateTime., and so on. Example addWorkDays(epochDate(1659484800), numWorkDays)
amazon-quicksight-user-097
amazon-quicksight-user.pdf
97
2016 Dec 28 07:05 addWorkDays addWorkDays Adds or subtracts a designated number of work days to a given date value. The function returns a date for a work day, that falls a designated work days after or before a given input date value. Syntax addWorkDays(initDate, numWorkDays) Arguments initDate A valid non-NULL date that acts as the start date for the calculation. • Dataset field – Any date field from the dataset that you are adding this function to. • Date function – Any date output from another date function, for example parseDate, epochDate, addDateTime., and so on. Example addWorkDays(epochDate(1659484800), numWorkDays) • Calculated fields – Any QuickSight calculated field that returns a date value. Example calcFieldStartDate = addDateTime(10, “DD”, startDate) addWorkDays(calcFieldStartDate, numWorkDays) Functions and operators 293 Amazon QuickSight User Guide • Parameters – Any QuickSight datetime parameter. Example addWorkDays($paramStartDate, numWorkDays) • Any combination of the above stated argument values. numWorkDays A non-NULL integer that acts as the end date for the calculation. • Literal – An integer literal directly typed in the expression editor. Example • Dataset field – Any date field from the dataset Example • Scalar function or calculation – Any scalar QuickSight function that returns an integer output from another, for example decimalToInt, abs, and so on. Example addWorkDays(initDate, decimalToInt(sqrt (abs(numWorkDays)) ) ) • Calculated field – Any QuickSight calculated field that returns a date value. Example someOtherIntegerCalcField = (num_days * 2) + 12 addWorkDays(initDate, someOtherIntegerCalcField) • Parameter – Any QuickSight datetime parameter. Example addWorkDays(initDate, $param_numWorkDays) • Any combination of the above stated argument values. Functions and operators 294 Amazon QuickSight Return type Integer Ouptut values User Guide Expected output values include: • Positive integer (when start_date < end_date) • Negative integer (when start_date > end_date) • NULL when one or both of the arguments get a null value from the dataset field. Input errors Disallowed argument values cause errors, as shown in the following examples. • Using a literal NULL as an argument in the expression is disallowed. Example addWorkDays(NULL, numWorkDays) Example Error At least one of the arguments in this function does not have correct type. Correct the expression and choose Create again. • Using a string literal as an argument, or any other data type other than a date, in the expression is disallowed. In the following example, the string "2022-08-10" looks like a date, but it is actually a string. To use it, you would have to use a function that converts to a date data type. Example addWorkDays("2022-08-10", 10) Example Error Expression addWorkDays("2022-08-10", numWorkDays) for function addWorkDays has Functions and operators 295 Amazon QuickSight User Guide incorrect argument type addWorkDays(String, Number). Function syntax expects Date, Integer. Example A positive integer as numWorkDays argument will yield a date in the future of the input date. A negative integer as numWorkDays argument will yield a resultant date in the past of the input date. A zero value for the numWorkDays argument yields the same value as input date whether or not it falls on a work day or a weekend. The addWorkDays function operates at the granularity: DAY. Accuracy cannot be preserved at any granularity which is lower or higher than DAY level. addWorkDays(startDate, endDate) Let’s assume there is a field named employmentStartDate with the following values: 2022-08-10 2022-08-06 2022-08-07 Using the above field and following calculations, addWorkDays returns the modified values as shown below: addWorkDays(employmentStartDate, 7) 2022-08-19 2022-08-16 2022-08-16 addWorkDays(employmentStartDate, -5) 2022-08-02 2022-08-01 2022-08-03 addWorkDays(employmentStartDate, 0) 2022-08-10 2022-08-06 2022-08-07 Functions and operators 296 Amazon QuickSight User Guide The following example calculates the total pro-rated bonus to be paid to each employee for 2 years based on how many days each employee has actually worked. last_day_of_work = addWorkDays(employment_start_date, 730) total_days_worked = netWorkDays(employment_start_date, last_day_of_work) total_bonus = total_days_worked * bonus_per_day Abs abs returns the absolute value of a given expression. Syntax abs(expression) Functions and operators 297 Amazon QuickSight Arguments expression User Guide The expression must be numeric. It can be a field name, a literal value, or another function. Ceil ceil rounds a decimal value to the next highest integer. For example, ceil(29.02) returns 30. Syntax ceil(decimal) Arguments decimal A field that uses the decimal data type, a literal value like 17.62, or a call to another function that outputs a decimal. Return type Integer Example The following example rounds a decimal field to the next highest integer. ceil(salesAmount) The following are the given field values. 20.13 892.03 57.54 For these field values, the following values are returned. 21 893 Functions and operators 298 Amazon QuickSight 58 Coalesce User Guide coalesce returns the value of the first argument that is not null. When a non-null value is found, the remaining arguments in the list are not evaluated. If all arguments are null, the result is null. 0- length strings are valid values and are not considered equivalent
amazon-quicksight-user-098
amazon-quicksight-user.pdf
98
function that outputs a decimal. Return type Integer Example The following example rounds a decimal field to the next highest integer. ceil(salesAmount) The following are the given field values. 20.13 892.03 57.54 For these field values, the following values are returned. 21 893 Functions and operators 298 Amazon QuickSight 58 Coalesce User Guide coalesce returns the value of the first argument that is not null. When a non-null value is found, the remaining arguments in the list are not evaluated. If all arguments are null, the result is null. 0- length strings are valid values and are not considered equivalent to null. Syntax coalesce(expression1, expression2 [, expression3, ...]) Arguments coalesce takes two or more expressions as arguments. All of the expressions must have the same data type or be able to be implicitly cast to the same data type. expression The expression can be numeric, datetime, or string. It can be a field name, a literal value, or another function. Return type coalesce returns a value of the same data type as the input arguments. Example The following example retrieves a customer's billing address if it exists, her street address if there is no billing address, or returns "No address listed" if neither address is available. coalesce(billingAddress, streetAddress, 'No address listed') Concat concat concatenates two or more strings. Syntax concat(expression1, expression2 [, expression3 ...]) Functions and operators 299 Amazon QuickSight Arguments concat takes two or more string expressions as arguments. expression User Guide The expression must be a string. It can be the name of a field that uses the string data type, a literal value like '12 Main Street', or a call to another function that outputs a string. Return type String Examples The following example concatenates three string fields and adds appropriate spacing. concat(salutation, ' ', firstName, ' ', lastName) The following are the given field values. salutation firstName lastName ------------------------------------------------------- Ms. Li Juan Dr. Ana Carolina Silva Mr. Nikhil Jayashankar For these field values, the following values are returned. Ms. Li Juan Dr. Ana Carolina Silva Mr. Nikhil Jayashankar The following example concatenates two string literals. concat('Hello', 'world') The following value is returned. Helloworld Functions and operators 300 Amazon QuickSight contains User Guide contains evaluates if the substring that you specify exists within an expression. If the expression contains the substring, contains returns true, and otherwise it returns false. Syntax contains(expression, substring, string-comparison-mode) Arguments expression The expression must be a string. It can be the name of a field that uses the string data type, a literal value like '12 Main Street', or a call to another function that outputs a string. substring The set of characters to check against the expression. The substring can occur one or more times in the expression. string-comparison-mode (Optional) Specifies the string comparison mode to use: • CASE_SENSITIVE – String comparisons are case-sensitive. • CASE_INSENSITIVE – String comparisons are case-insensitive. This value defaults to CASE_SENSITIVE when blank. Return type Boolean Examples Default case sensitive example The following case sensitive example evaluates if state_nm contains New. contains(state_nm, "New") Functions and operators 301 Amazon QuickSight User Guide The following are the given field values. New York new york For these field values, the following values are returned. true false Case insensitive example The following case insensitive example evaluates if state_nm contains new. contains(state_nm, "new", CASE_INSENSITIVE) The following are the given field values. New York new york For these field values, the following values are returned. true true Example with conditional statements The contains function can be used as the conditional statement within the following If functions: avgIf, minIf, distinct_countIf, countIf, maxIf, medianIf, stdevIf, stdevpIf, sumIf, varIf, and varpIf. The following example sums Sales only if state_nm contains New. sumIf(Sales,contains(state_nm, "New")) Does NOT contain example The conditional NOT operator can be used to evaluate if the expression does not contain the specified substring. Functions and operators 302 Amazon QuickSight User Guide NOT(contains(state_nm, "New")) Example using numeric values Numeric values can be used in the expression or substring arguments by applying the toString function. contains(state_nm, toString(5) ) decimalToInt decimalToInt converts a decimal value to the integer data type by stripping off the decimal point and any numbers after it. decimalToInt does not round up. For example, decimalToInt(29.99) returns 29. Syntax decimalToInt(decimal) Arguments decimal A field that uses the decimal data type, a literal value like 17.62, or a call to another function that outputs a decimal. Return type Integer Example The following example converts a decimal field to an integer. decimalToInt(salesAmount) The following are the given field values. 20.13 Functions and operators 303 Amazon QuickSight 892.03 57.54 For these field values, the following values are returned. User Guide 20 892 57 dateDiff dateDiff returns the difference in days between two date fields. If you include a value for the period, dateDiff returns the difference in
amazon-quicksight-user-099
amazon-quicksight-user.pdf
99
example, decimalToInt(29.99) returns 29. Syntax decimalToInt(decimal) Arguments decimal A field that uses the decimal data type, a literal value like 17.62, or a call to another function that outputs a decimal. Return type Integer Example The following example converts a decimal field to an integer. decimalToInt(salesAmount) The following are the given field values. 20.13 Functions and operators 303 Amazon QuickSight 892.03 57.54 For these field values, the following values are returned. User Guide 20 892 57 dateDiff dateDiff returns the difference in days between two date fields. If you include a value for the period, dateDiff returns the difference in the period interval, rather than in days. Syntax dateDiff(date1, date2,[period]) Arguments dateDiff takes two dates as arguments. Specifying a period is optional. date 1 The first date in the comparison. A date field or a call to another function that outputs a date. date 2 The second date in the comparison. A date field or a call to another function that outputs a date. period The period of difference that you want returned, enclosed in quotes. Valid periods are as follows: • YYYY: This returns the year portion of the date. • Q: This returns the date of the first day of the quarter that the date belongs to. • MM: This returns the month portion of the date. • DD: This returns the day portion of the date. Functions and operators 304 Amazon QuickSight User Guide • WK: This returns the week portion of the date. The week starts on Sunday in Amazon QuickSight. • HH: This returns the hour portion of the date. • MI: This returns the minute portion of the date. • SS: This returns the second portion of the date. • MS: This returns the millisecond portion of the date. Return type Integer Example The following example returns the difference between two dates. dateDiff(orderDate, shipDate, "MM") The following are the given field values. orderDate shipdate ============================= 01/01/18 03/05/18 09/13/17 10/20/17 For these field values, the following values are returned. 2 1 endsWith endsWith evaluates if the expression ends with a substring that you specify. If the expression ends with the substring, endsWith returns true, and otherwise it returns false. Syntax endsWith(expression, substring, string-comparison-mode) Functions and operators 305 Amazon QuickSight Arguments expression User Guide The expression must be a string. It can be the name of a field that uses the string data type, a literal value like '12 Main Street', or a call to another function that outputs a string. substring The set of characters to check against the expression. The substring can occur one or more times in the expression. string-comparison-mode (Optional) Specifies the string comparison mode to use: • CASE_SENSITIVE – String comparisons are case-sensitive. • CASE_INSENSITIVE – String comparisons are case-insensitive. This value defaults to CASE_SENSITIVE when blank. Return type Boolean Examples Default case sensitive example The following case sensitive example evaluates if state_nm endsWith "York". endsWith(state_nm, "York") The following are the given field values. New York new york For these field values, the following values are returned. true Functions and operators 306 Amazon QuickSight false Case insensitive example User Guide The following case insensitive example evaluates if state_nm endsWith "york". endsWith(state_nm, "york", CASE_INSENSITIVE) The following are the given field values. New York new york For these field values, the following values are returned. true true Example with conditional statements The endsWith function can be used as the conditional statement within the following If functions: avgIf, minIf, distinct_countIf, countIf, maxIf, medianIf, stdevIf, stdevpIf, sumIf, varIf, and varpIf. The following example sums Sales only if state_nm ends with "York". sumIf(Sales,endsWith(state_nm, "York")) Does NOT contain example The conditional NOT operator can be used to evaluate if the expression does not start with the specified substring. NOT(endsWith(state_nm, "York")) Example using numeric values Numeric values can be used in the expression or substring arguments by applying the toString function. Functions and operators 307 Amazon QuickSight User Guide endsWith(state_nm, toString(5) ) epochDate epochDate converts an epoch date into a standard date in the format yyyy-MM- ddTkk:mm:ss.SSSZ, using the format pattern syntax specified in Class DateTimeFormat in the Joda project documentation. An example is 2015-10-15T19:11:51.003Z. epochDate is supported for use with analyses based on datasets stored in QuickSight (SPICE). Syntax epochDate(epochdate) Arguments epochdate An epoch date, which is an integer representation of a date as the number of seconds since 00:00:00 UTC on January 1, 1970. epochdate must be an integer. It can be the name of a field that uses the integer data type, a literal integer value, or a call to another function that outputs an integer. If the integer value is longer than 10 digits, the digits after the 10th place are discarded. Return type Date Example The following example converts an epoch date to a standard date. epochDate(3100768000) The following value is returned. 2068-04-04T12:26:40.000Z
amazon-quicksight-user-100
amazon-quicksight-user.pdf
100
(SPICE). Syntax epochDate(epochdate) Arguments epochdate An epoch date, which is an integer representation of a date as the number of seconds since 00:00:00 UTC on January 1, 1970. epochdate must be an integer. It can be the name of a field that uses the integer data type, a literal integer value, or a call to another function that outputs an integer. If the integer value is longer than 10 digits, the digits after the 10th place are discarded. Return type Date Example The following example converts an epoch date to a standard date. epochDate(3100768000) The following value is returned. 2068-04-04T12:26:40.000Z Functions and operators 308 Amazon QuickSight Exp User Guide exp returns the base of natural log e raised to the power of a given expression. Syntax exp(expression) Arguments expression The expression must be numeric. It can be a field name, a literal value, or another function. Extract extract returns a specified portion of a date value. Requesting a time-related portion of a date that doesn't contain time information returns 0. Syntax extract(period, date) Arguments period The period that you want extracted from the date value. Valid periods are as follows: • YYYY: This returns the year portion of the date. • Q: This returns the quarter that the date belongs to (1–4). • MM: This returns the month portion of the date. • DD: This returns the day portion of the date. • WD: This returns the day of the week as an integer, with Sunday as 1. • HH: This returns the hour portion of the date. • MI: This returns the minute portion of the date. • SS: This returns the second portion of the date. • MS: This returns the millisecond portion of the date. Functions and operators 309 Amazon QuickSight Note User Guide Extracting milliseconds is not supported in Presto databases below version 0.216. date A date field or a call to another function that outputs a date. Return type Integer Example The following example extracts the day from a date value. extract('DD', orderDate) The following are the given field values. orderDate ========= 01/01/14 09/13/16 For these field values, the following values are returned. 01 13 Floor floor decrements a decimal value to the next lowest integer. For example, floor(29.08) returns 29. Syntax floor(decimal) Functions and operators 310 Amazon QuickSight Arguments decimal User Guide A field that uses the decimal data type, a literal value like 17.62, or a call to another function that outputs a decimal. Return type Integer Example The following example decrements a decimal field to the next lowest integer. floor(salesAmount) The following are the given field values. 20.13 892.03 57.54 For these field values, the following values are returned. 20 892 57 formatDate formatDate formats a date using a pattern you specify. When you are preparing data, you can use formatDate to reformat the date. To reformat a date in an analysis, you choose the format option from the context menu on the date field. Syntax formatDate(date, ['format']) Functions and operators 311 Amazon QuickSight Arguments date User Guide A date field or a call to another function that outputs a date. format (Optional) A string containing the format pattern to apply. This argument accepts the format patterns specified in Supported date formats. If you don't specify a format, this string defaults to yyyy-MM-ddTkk:mm:ss:SSS. Return type String Example The following example formats a UTC date. formatDate(orderDate, 'dd-MMM-yyyy') The following are the given field values. order date ========= 2012-12-14T00:00:00.000Z 2013-12-29T00:00:00.000Z 2012-11-15T00:00:00.000Z For these field values, the following values are returned. 13 Dec 2012 28 Dec 2013 14 Nov 2012 Example If the date contains single quotes or apostrophes, for example yyyyMMdd'T'HHmmss, you can handle this date format by using one of the following methods. Functions and operators 312 Amazon QuickSight User Guide • Enclose the entire date in double quotes, as shown in the following example: formatDate({myDateField}, "yyyyMMdd'T'HHmmss") • Escape the single quotes or apostrophes by adding a backslash ( \ ) to the left of them, as shown in the following example: formatDate({myDateField}, 'yyyyMMdd\'T\'HHmmss') Ifelse ifelse evaluates a set of if, then expression pairings, and returns the value of the then argument for the first if argument that evaluates to true. If none of the if arguments evaluate to true, then the value of the else argument is returned. Syntax ifelse(if-expression-1, then-expression-1 [, if-expression-n, then-expression-n ...], else-expression) Arguments ifelse requires one or more if,then expression pairings, and requires exactly one expression for the else argument. if-expression The expression to be evaluated as true or not. It can be a field name like address1, a literal value like 'Unknown', or another function like toString(salesAmount). An example is isNotNull(FieldName). If you use multiple AND and OR operators in the if argument, enclose statements in parentheses to identify processing order. For example, the following if argument
amazon-quicksight-user-101
amazon-quicksight-user.pdf
101
of the if arguments evaluate to true, then the value of the else argument is returned. Syntax ifelse(if-expression-1, then-expression-1 [, if-expression-n, then-expression-n ...], else-expression) Arguments ifelse requires one or more if,then expression pairings, and requires exactly one expression for the else argument. if-expression The expression to be evaluated as true or not. It can be a field name like address1, a literal value like 'Unknown', or another function like toString(salesAmount). An example is isNotNull(FieldName). If you use multiple AND and OR operators in the if argument, enclose statements in parentheses to identify processing order. For example, the following if argument returns records with a month of 1, 2, or 5 and a year of 2000. ifelse((month = 5 OR month < 3) AND year = 2000, 'yes', 'no') The next if argument uses the same operators, but returns records with a month of 5 and any year, or with a month of 1 or 2 and a year of 2000. Functions and operators 313 Amazon QuickSight User Guide ifelse(month = 5 OR (month < 3 AND year = 2000), 'yes', 'no') then-expression The expression to return if its if argument is evaluated as true. It can be a field name like address1, a literal value like 'Unknown', or a call to another function. The expression must have the same data type as the other then arguments and the else argument. else-expression The expression to return if none of the if arguments evaluate as true. It can be a field name like address1, a literal value like 'Unknown', or another function like toString(salesAmount). The expression must have the same data type as all of the then arguments. Return type ifelse returns a value of the same data type as the values in then-expression. All data returned then and else expressions must be of the same data type or be converted to the same data type. Examples The following example generates a column of aliases for field country. ifelse(country = "United States", "US", country = "China", "CN", country = "India", "IN", "Others") For such use cases evaluating each value in a field against a list of literals, and returns the result corresponding to the first matching value., function switch is recommended to simplify your work. The previous example can be rewritten to the following statement using switch: switch(country,"United States","US","China","CN","India","IN","Others") The following example categorizes sales per customer into human-readable levels. ifelse(salesPerCustomer < 1000, “VERY_LOW”, salesPerCustomer < 10000, “LOW”, salesPerCustomer < 100000, “MEDIUM”, “HIGH”) The following example uses AND, OR, and NOT to compare multiple expressions using conditional operators to tag top customers NOT in Washington or Oregon with a special promotion, who made more than 10 orders. If no values are returned, the value 'n/a' is used. Functions and operators 314 Amazon QuickSight User Guide ifelse(( (NOT (State = 'WA' OR State = 'OR')) AND Orders > 10), 'Special Promotion XYZ', 'n/a') The following examples use only OR to generate a new column that contains the name of continent that corresponds to each country. ifelse(country = "United States" OR country = "Canada", "North America", country = "China" OR country = "India" OR country = "Japan", "Asia", "Others") The previous example can be simplified as shown in the next example. The following example uses ifelse and in to create a value in a new column for any row where the tested value is in a literal list. You could use ifelse with notIn as well. ifelse(in(country,["United States", "Canada"]), "North America", in(country, ["China","Japan","India"]),"Asia","Others") Authors are able to save a literal list in a multivalue parameter and use it in the in or notIn functions. The following example is an equivalent of the previous example, except that the literal lists are stored in two multivalue parameters. ifelse(in(country,${NorthAmericaCountryParam}), "North America", in(country, ${AsiaCountryParam}),"Asia", "Others") The following example assigns a group to a sales record based on the sales total. The structure of each if-then phrase mimics the behavior of between, a keyword that doesn't currently work in calculated field expressions. For example, the result of the comparison salesTotal >= 0 AND salesTotal < 500 returns the same values as the SQL comparison salesTotal between 0 and 499. ifelse(salesTotal >= 0 AND salesTotal < 500, 'Group 1', salesTotal >= 500 AND salesTotal < 1000, 'Group 2', 'Group 3') The following example tests for a NULL value by using coalesce to return the first non-NULL value. Instead of needing to remember the meaning of a NULL in a date field, you can use a readable description instead. If the disconnect date is NULL, the example returns the suspend date, unless both of those are NULL. Then coalesce(DiscoDate, SuspendDate, '12/31/2491') returns '12/31/2491'. The return value must match the other data types. This date might seem Functions and operators 315 Amazon QuickSight User Guide like an unusual value, but a date in
amazon-quicksight-user-102
amazon-quicksight-user.pdf
102
500 AND salesTotal < 1000, 'Group 2', 'Group 3') The following example tests for a NULL value by using coalesce to return the first non-NULL value. Instead of needing to remember the meaning of a NULL in a date field, you can use a readable description instead. If the disconnect date is NULL, the example returns the suspend date, unless both of those are NULL. Then coalesce(DiscoDate, SuspendDate, '12/31/2491') returns '12/31/2491'. The return value must match the other data types. This date might seem Functions and operators 315 Amazon QuickSight User Guide like an unusual value, but a date in the 25th century reasonably simulates the "end of time," defined as the highest date in a data mart. ifelse ( (coalesce(DiscoDate, SuspendDate, '12/31/2491') = '12/31/2491'), 'Active subscriber', 'Inactive subscriber') The following shows a more complex example in a more readable format, just to show that you don't need to compress your code all into one long line. This example provides for multiple comparisons of the value a survey result. It handles potential NULL values for this field and categorizes two acceptable ranges. It also labels one range that needs more testing and another that's not valid (out of range). For all remaining values, it applies the else condition, and labels the row as needing a retest three years after the date on that row. ifelse ( isNull({SurveyResult}), 'Untested', {SurveyResult}=1, 'Range 1', {SurveyResult}=2, 'Range 2', {SurveyResult}=3, 'Need more testing', {SurveyResult}=99, 'Out of Range', concat ( 'Retest by ', toString ( addDateTime(3, "YYYY", {Date}) ) ) ) The following example assigns a "manually" created region name to a group of states. It also uses spacing and comments, wrapped in /* */, to make it easier to maintain the code. ifelse ( /* NE REGION*/ locate('New York, New Jersey, Connecticut, Vermont, Maine, Rhode Island, New Hampshire',{State}) > 0, 'Northeast', /* SE REGION*/ locate('Georgia, Alabama, South Carolina, Louisiana',{State}) > 0, Functions and operators 316 Amazon QuickSight 'Southeast', 'Other Region' ) User Guide The logic for the region tagging breaks down as follows: 1. We list the states that we want for each region, enclosing each list in quotation marks to make each list a string, as follows: • 'New York, New Jersey, Connecticut, Vermont, Maine, Rhode Island, New Hampshire' • 'Georgia, Alabama, South Carolina, Louisiana' • You can add more sets, or use countries, cities, provinces, or What3Words if you want. 2. We ask if the value for State (for each row) is found in the list, by using the locate function to return a nonzero value if the state is found in the list, as follows. locate('New York, New Jersey, Connecticut, Vermont, Maine, Rhode Island, New Hampshire',{State}) and locate('Georgia, Alabama, South Carolina, Louisiana',{State}) 3. The locate function returns a number instead of a TRUE or FALSE, but ifelse requires the TRUE/FALSE Boolean value. To get around this, we can compare the result of locate to a number. If the state is in the list, the return value is greater than zero. a. Ask if the state is present. locate('New York, New Jersey, Connecticut, Vermont, Maine, Rhode Island, New Hampshire',{State}) > 0 b. If it's present the region, label it as the specific region, in this case a Northeast region. /*The if expression:*/ locate('New York, New Jersey, Connecticut, Vermont, Maine, Rhode Island, New Hampshire',{State}) > 0, /*The then expression:*/ 'Northeast', 4. Because we have states that aren't in a list, and because ifelse requires a single else expression, we provide 'Other Region' as the label for the leftover states. Functions and operators 317 Amazon QuickSight User Guide /*The if expression:*/ locate('New York, New Jersey, Connecticut, Vermont, Maine, Rhode Island, New Hampshire',{State}) > 0, /*The then expression:*/ 'Northeast', /*The else expression:*/ 'Other Region' 5. We wrap all that in the ifelse( ) function to get the final version. The following example leaves out the Southeast region states that were in the original. You can add them back in place of the <insert more regions here> tag. If you want to add more regions, you can construct more copies of those two lines and alter the list of states to suit your purpose. You can change the region name to something that suits you, and change the field name from State to anything that you need. ifelse ( /*The if expression:*/ locate('New York, New Jersey, Connecticut, Vermont, Maine, Rhode Island, New Hampshire',{State}) > 0, /*The then expression:*/ 'Northeast', /*<insert more regions here>*/ /*The else expression:*/ 'Other Region' ) Note There are other ways to do the initial comparison for the if expression. For example, suppose that you pose the question "What states are not missing from this list?" rather than "Which states are on the list?" If you do, you might phrase it differently. You might compare the locate statement to zero to find values that
amazon-quicksight-user-103
amazon-quicksight-user.pdf
103
the field name from State to anything that you need. ifelse ( /*The if expression:*/ locate('New York, New Jersey, Connecticut, Vermont, Maine, Rhode Island, New Hampshire',{State}) > 0, /*The then expression:*/ 'Northeast', /*<insert more regions here>*/ /*The else expression:*/ 'Other Region' ) Note There are other ways to do the initial comparison for the if expression. For example, suppose that you pose the question "What states are not missing from this list?" rather than "Which states are on the list?" If you do, you might phrase it differently. You might compare the locate statement to zero to find values that are missing from the list, and then use the NOT operator to classify them as "not missing," as follows. /*The if expression:*/ NOT (locate('New York, New Jersey, Connecticut, Vermont, Maine, Rhode Island, New Hampshire',{State}) = 0), Both versions are correct. The version that you choose should make the most sense to you and your team, so you can maintain it easily. If all the options seem equal, choose the simplest. Functions and operators 318 Amazon QuickSight in User Guide in evaluates if an expression exists within a literal list. If the list contains the expression, in returns true, and otherwise it returns false. in is case sensitive for string type inputs. in accepts two kinds of literal list, one is manually entered list and the other is a multivalue parameter. Syntax Using a manually entered list: in(expression, [literal-1, ...]) Using a multivalue parameter: in(expression, $multivalue_parameter) Arguments expression The expression to be compared with the elements in literal list. It can be a field name like address, a literal value like ‘ Unknown’, a single value parameter, or a call to another scalar function—provided this function is not an aggregate function or a table calculation. literal list (required) This can be a manually entered list or a multivalue parameter. This argument accepts up to 5,000 elements. However, in a direct query to a third party data source, for example Oracle or Teradata, the restriction can be smaller. • manually entered list – One or more literal values in a list to be compared with the expression. The list should be enclosed in square brackets. All the literals to compare must have the same datatype as the expression. • multivalue parameter – A pre-defined multivalue parameter passed in as a literal list. The multivalue parameter must have the same datatype as the expression. Return type Boolean: TRUE/FALSE Functions and operators 319 Amazon QuickSight Example with a static list User Guide The following example evaluates the origin_state_name field for values in a list of string. When comparing string type input, in only supports case sensitive comparison. in(origin_state_name,["Georgia", "Ohio", "Texas"]) The following are the given field values. "Washington" "ohio" "Texas" For these field values the following values are returned. false false true The third return value is true because only "Texas" is one of the included values. The following example evaluates the fl_date field for values in a list of string. In order to match the type, toString is used to cast the date type to string type. in(toString(fl_date),["2015-05-14","2015-05-15","2015-05-16"]) Functions and operators 320 Amazon QuickSight User Guide Literals and NULL values are supported in expression argument to be compared with the literals in list. Both of the following two examples will generate a new column of TRUE values. in("Washington",["Washington","Ohio"]) in(NULL,[NULL,"Ohio"]) Example with mutivalue parameter Let's say an author creates a multivalue parameter that contains a list of all the state names. Then the author adds a control to allow the reader to select values from the list. Next, the reader selects three values—"Georgia", "Ohio", and "Texas"—from the parameter's drop down list control. In this case, the following expression is equivalent to the first example, where those three state names are passed as the literal list to be compared with the original_state_name field. Functions and operators 321 Amazon QuickSight User Guide in (origin_state_name, ${stateName MultivalueParameter}) Example with ifelse in can be nested in other functions as a boolean value. One example is that authors can evaluate any expression in a list and return the value they want by using in and ifelse. The following example evaluates if the dest_state_name of a flight is in a particular list of US states and returns different categories of the states based on the comparison. ifelse(in(dest_state_name,["Washington", "Oregon","California"]), "WestCoastUSState", "Other US State") Functions and operators 322 Amazon QuickSight intToDecimal User Guide intToDecimal converts an integer value to the decimal data type. Syntax intToDecimal(integer) Arguments int A field that uses the integer data type, a literal value like 14, or a call to another function that outputs an integer. Return type Decimal Example The following example converts an integer field to a decimal. intToDecimal(price) The following are the given field values. 20 892 57 For these field values, the following values
amazon-quicksight-user-104
amazon-quicksight-user.pdf
104
particular list of US states and returns different categories of the states based on the comparison. ifelse(in(dest_state_name,["Washington", "Oregon","California"]), "WestCoastUSState", "Other US State") Functions and operators 322 Amazon QuickSight intToDecimal User Guide intToDecimal converts an integer value to the decimal data type. Syntax intToDecimal(integer) Arguments int A field that uses the integer data type, a literal value like 14, or a call to another function that outputs an integer. Return type Decimal Example The following example converts an integer field to a decimal. intToDecimal(price) The following are the given field values. 20 892 57 For these field values, the following values are returned. 20.0 892.0 58.0 You can apply formatting inside an analysis, for example to format price as currency. Functions and operators 323 Amazon QuickSight isNotNull User Guide isNotNull evaluates an expression to see if it is not null. If the expression is not null, isNotNull returns true, and otherwise it returns false. Syntax isNotNull(expression) Arguments expression The expression to be evaluated as null or not. It can be a field name like address1 or a call to another function that outputs a string. Return type Boolean Example The following example evaluates the sales_amount field for null values. isNotNull(salesAmount) The following are the given field values. 20.13 (null) 57.54 For these field values, the following values are returned. true false true Functions and operators 324 Amazon QuickSight isNull User Guide isNull evaluates an expression to see if it is null. If the expression is null, isNull returns true, and otherwise it returns false. Syntax isNull(expression) Arguments expression The expression to be evaluated as null or not. It can be a field name like address1 or a call to another function that outputs a string. Return type Boolean Example The following example evaluates the sales_amount field for null values. isNull(salesAmount) The following are the given field values. 20.13 (null) 57.54 For these field values, the following values are returned. false true false The following example tests for a NULL value in an ifelse statement, and returns a human- readable value instead. Functions and operators 325 Amazon QuickSight User Guide ifelse( isNull({ActiveFlag}) , 'Inactive', 'Active') isWorkDay isWorkDay evaluates a given date-time value to determine if the value is a workday or not. isWorkDay assumes a standard 5-day work week starting from Monday and ending on Friday. Saturday and Sunday are assumed to be weekends. The function always calculates its result at the DAY granularity and is exclusive of the given input date. Syntax isWorkDay(inputDate) Arguments inputDate The date-time value that you want to evaluate. Valid values are as follows: • Dataset fields: Any date field from the dataset that you are adding this function to. • Date Functions: Any date output from another date function, for example, parseDate. • Calculated fields: Any QuickSight calculated field that returns a date value. • Parameters: Any QuickSight DateTime parameter. Return type Integer (0 or 1) Example The following exaple determines whether or not the application_date field is a work day. Let's assume that there's a field named application_date with the following values: 2022-08-10 2022-08-06 2022-08-07 When you use these fields and add the following calculations, isWorkDay returns the below values: Functions and operators 326 Amazon QuickSight User Guide isWorkDay({application_date}) 1 0 0 The following example filters employees whose employment ends on a work day and determines whether their employment began on work day or a weekend using conditional formatting: is_start_date_work_day = isWorkDay(employment_start_date) is_end_date_work_day = isWorkDay(employment_end_date) Left left returns the leftmost characters from a string, including spaces. You specify the number of characters to be returned. Functions and operators 327 Amazon QuickSight Syntax left(expression, limit) Arguments expression User Guide The expression must be a string. It can be the name of a field that uses the string data type, a literal value like '12 Main Street', or a call to another function that outputs a string. limit The number of characters to be returned from expression, starting from the first character in the string. Return type String Example The following example returns the first 3 characters from a string. left('Seattle Store #14', 3) The following value is returned. Sea Locate locate locates a substring that you specify within another string, and returns the number of characters until the first character in the substring. The function returns 0 if it doesn't find the substring. The function is 1-based. Syntax locate(expression, substring, start) Functions and operators 328 Amazon QuickSight Arguments expression User Guide The expression must be a string. It can be the name of a field that uses the string data type, a literal value like '12 Main Street', or a call to another function that outputs a string. substring The set of characters in expression that you want to locate. The substring can occur one or more times in expression. start (Optional) If substring occurs more
amazon-quicksight-user-105
amazon-quicksight-user.pdf
105
until the first character in the substring. The function returns 0 if it doesn't find the substring. The function is 1-based. Syntax locate(expression, substring, start) Functions and operators 328 Amazon QuickSight Arguments expression User Guide The expression must be a string. It can be the name of a field that uses the string data type, a literal value like '12 Main Street', or a call to another function that outputs a string. substring The set of characters in expression that you want to locate. The substring can occur one or more times in expression. start (Optional) If substring occurs more than once, use start to identify where in the string the function should start looking for the substring. For example, suppose that you want to find the second example of a substring and you think it typically occurs after the first 10 characters. You specify a start value of 10. It should start from 1. Return type Integer Examples The following example returns information about where the first occurrence of the substring 'and' appears in a string. locate('1 and 2 and 3 and 4', 'and') The following value is returned. 3 The following example returns information about where the first occurrence of the substring 'and' appears in a string after the fourth character. locate('1 and 2 and 3 and 4', 'and', 4) The following value is returned. Functions and operators 329 Amazon QuickSight User Guide 9 Log log returns the base 10 logarithm of a given expression. Syntax log(expression) Arguments expression The expression must be numeric. It can be a field name, a literal value, or another function. Ln ln returns the natural logarithm of a given expression. Syntax ln(expression) Arguments expression The expression must be numeric. It can be a field name, a literal value, or another function. Ltrim ltrim removes preceding blank space from a string. Syntax ltrim(expression) Functions and operators 330 Amazon QuickSight Arguments expression User Guide The expression must be a string. It can be the name of a field that uses the string data type, a literal value like '12 Main Street', or a call to another function that outputs a string. Return type String Example The following example removes the preceding spaces from a string. ltrim(' Seattle Store #14') The following value is returned. Seattle Store #14 Mod Use the mod function to find the remainder after dividing the number by the divisor. You can use the mod function or the modulo operator (%) interchangeably. Syntax mod(number, divisor) number%divisor Arguments number The number is the positive integer that you want to divide and find the remainder for. divisor The divisor is the positive integer that you are dividing by. If the divisor is zero, this function returns an error on dividing by 0. Functions and operators 331 Amazon QuickSight Example User Guide The following examples return the modulo of 17 when dividing by 6. The first example uses the % operator, and the second example uses the mod function. 17%6 mod( 17, 6 ) The following value is returned. 5 netWorkDays netWorkDays returns the number of working days between the provided two date fields or even custom date values generated using other QuickSight date functions such as parseDate or epochDate as an integer. netWorkDays assumes a standard 5-day work week starting from Monday and ending on Friday. Saturday and Sunday are assumed to be weekends. The calculation is inclusive of both startDate and endDate. The function operates on and shows results for DAY granularity. Syntax netWorkDays(startDate, endDate) Arguments startDate A valid non-NULL date that acts as the start date for the calculation. • Dataset fields: Any date field from the dataset that you are adding this function to. • Date Functions: Any date output from another date function, for example, parseDate. • Calculated fields: Any QuickSight calculated field that returns a date value. • Parameters: Any QuickSight DateTime parameter. Functions and operators 332 Amazon QuickSight User Guide • Any combination of the above stated argument values. endDate A valid non-NULL date that acts as the end date for the calculation. • Dataset fields: Any date field from the dataset that you are adding this function to. • Date Functions: Any date output from another date function, for example, parseDate. • Calculated fields: Any QuickSight calculated field that returns a date value. • Parameters: Any QuickSight DateTime parameter. • Any combination of the above stated argument values. Return type Integer Ouptut values Expected output values include: • Positive integer (when start_date < end_date) • Negative integer (when start_date > end_date) • NULL when one or both of the arguments get a null value from the dataset field. Example The following example returns the number of work days falling between two dates. Let's assume that there's a field named application_date with the following values: netWorkDays({startDate}, {endDate})
amazon-quicksight-user-106
amazon-quicksight-user.pdf
106
date function, for example, parseDate. • Calculated fields: Any QuickSight calculated field that returns a date value. • Parameters: Any QuickSight DateTime parameter. • Any combination of the above stated argument values. Return type Integer Ouptut values Expected output values include: • Positive integer (when start_date < end_date) • Negative integer (when start_date > end_date) • NULL when one or both of the arguments get a null value from the dataset field. Example The following example returns the number of work days falling between two dates. Let's assume that there's a field named application_date with the following values: netWorkDays({startDate}, {endDate}) The following are the given field values. startDate endDate netWorkDays 9/4/2022 9/11/2022 5 9/9/2022 9/2/2022 -6 9/10/2022 9/11/2022 0 Functions and operators 333 Amazon QuickSight 9/12/2022 9/12/2022 1 User Guide The following example calculates the number of days worked by each employee and the salary expended per day for each employee: days_worked = netWorkDays({employment_start_date}, {employment_end_date}) salary_per_day = {salary}/{days_worked} The following example filters employees whose employment ends on a work day and determines whether their employment began on work day or a weekend using conditional formatting: is_start_date_work_day = netWorkDays(employment_start_date) is_end_date_work_day = netWorkDays(employment_end_date) Functions and operators 334 Amazon QuickSight Now User Guide For database datasets that directly query the database, now returns the current date and time using the settings and format specified by the database server. For SPICE and Salesforce data sets, now returns the UTC date and time, in the format yyyy-MM-ddTkk:mm:ss:SSSZ (for example, 2015-10-15T19:11:51:003Z). Syntax now() Return type Date notIn notIn evaluates if an expression exists within a literal list. If the list doesn’t contain the expression, notIn returns true, and otherwise it returns false. notIn is case sensitive for string type inputs. notIn accepts two kinds of literal list, one is manually entered list and the other is a multivalue parameter. Syntax Using a manually entered list: notIn(expression, [literal-1, ...]) Using a multivalue parameter: notIn(expression, $multivalue_parameter) Arguments expression The expression to be compared with the elements in literal list. It can be a field name like address, a literal value like ‘ Unknown’, a single value parameter, or a call to another scalar function—provided this function is not an aggregate function or a table calculation. Functions and operators 335 Amazon QuickSight literal list User Guide (required) This can be a manually entered list or a multivalue parameter. This argument accepts up to 5,000 elements. However, in a direct query to a third party data source, for example Oracle or Teradata, the restriction can be smaller. • manually entered list – One or more literal values in a list to be compared with the expression. The list should be enclosed in square brackets. All the literals to compare must have the same datatype as the expression. • multivalue parameter – A pre-defined multivalue parameter passed in as a literal list. The multivalue parameter must have the same datatype as the expression. Return type Boolean: TRUE/FALSE Example with a manually entered list The following example evaluates the origin_state_name field for values in a list of string. When comparing string type input, notIn only supports case sensitive comparison. notIn(origin_state_name,["Georgia", "Ohio", "Texas"]) The following are the given field values. "Washington" "ohio" "Texas" For these field values the following values are returned. true true false The third return value is false because only "Texas" is one of the excluded values. The following example evaluates the fl_date field for values in a list of string. In order to match the type, toString is used to cast the date type to string type. Functions and operators 336 Amazon QuickSight User Guide notIn(toString(fl_date),["2015-05-14","2015-05-15","2015-05-16"]) Literals and NULL values are supported in expression argument to be compared with the literals in list. Both of the following two examples will generate a new column of FALSE values. notIn("Washington",["Washington","Ohio"]) notIn(NULL,[NULL,"Ohio"]) Example with mutivalue parameter Let's say an author creates a multivalue parameter that contains a list of all the state names. Then the author adds a control to allow the reader to select values from the list. Next, the reader selects three values—"Georgia", "Ohio", and "Texas"—from the parameter's drop down list control. In this case, the following expression is equivalent to the first Functions and operators 337 Amazon QuickSight User Guide example, where those three state names are passed as the literal list to be compared with the original_state_name field. notIn (origin_state_name, ${stateName MultivalueParameter}) Example with ifelse notIn can be nested in other functions as a boolean value. One example is that authors can evaluate any expression in a list and return the value they want by using notIn and ifelse. The following example evaluates if the dest_state_name of a flight is in a particular list of US states and returns different categories of the states based on the comparison. ifelse(notIn(dest_state_name,["Washington", "Oregon","California"]), "notWestCoastUSState", "WestCoastUSState") Functions and operators 338 Amazon QuickSight
amazon-quicksight-user-107
amazon-quicksight-user.pdf
107
Guide example, where those three state names are passed as the literal list to be compared with the original_state_name field. notIn (origin_state_name, ${stateName MultivalueParameter}) Example with ifelse notIn can be nested in other functions as a boolean value. One example is that authors can evaluate any expression in a list and return the value they want by using notIn and ifelse. The following example evaluates if the dest_state_name of a flight is in a particular list of US states and returns different categories of the states based on the comparison. ifelse(notIn(dest_state_name,["Washington", "Oregon","California"]), "notWestCoastUSState", "WestCoastUSState") Functions and operators 338 Amazon QuickSight nullIf User Guide nullIf compares two expressions. If they are equal, the function returns null. If they are not equal, the function returns the first expression. Syntax nullIf(expression1, expression2) Arguments nullIf takes two expressions as arguments. expression The expression can be numeric, datetime, or string. It can be a field name, a literal value, or another function. Return type String Example The following example returns nulls if the reason for a shipment delay is unknown. nullIf(delayReason, 'unknown') The following are the given field values. delayReason ============ unknown back ordered weather delay For these field values, the following values are returned. (null) back ordered weather delay Functions and operators 339 Amazon QuickSight parseDate User Guide parseDate parses a string to determine if it contains a date value, and returns a standard date in the format yyyy-MM-ddTkk:mm:ss.SSSZ (using the format pattern syntax specified in Class DateTimeFormat in the Joda project documentation), for example 2015-10-15T19:11:51.003Z. This function returns all rows that contain a date in a valid format and skips any rows that don't, including rows that contain null values. Amazon QuickSight supports dates in the range from Jan 1, 1900 00:00:00 UTC to Dec 31, 2037 23:59:59 UTC. For more information, see Supported date formats. Syntax parseDate(expression, ['format']) Arguments expression The expression must be a string. It can be the name of a field that uses the string data type, a literal value like '1/1/2016', or a call to another function that outputs a string. format (Optional) A string containing the format pattern that date_string must match. For example, if you are using a field with data like 01/03/2016, you specify the format 'MM/dd/yyyy'. If you don't specify a format, it defaults to yyyy-MM-dd. Rows whose data doesn't conform to format are skipped. Different date formats are supported based on the type of dataset used. Use the following table to see details of supported date formats. Date source type Supported date formats File, Amazon Athena, and Salesforce data s ets All date format patterns specified in Supported date formats. Direct query of Amazon Aurora, MariaDB, and MySQL databases MM/dd/yyyy • • Functions and operators 340 Amazon QuickSight User Guide Date source type Supported date formats dd/MM/yyyy yyyy/MM/dd MMM/dd/yyyy dd/MMM/yyyy yyyy/MMM/dd MM/dd/yyyy HH:mm:ss dd/MM/yyyy HH:mm:ss yyyy/MM/dd HH:mm:ss MMM/dd/yyyy HH:mm:ss dd/MMM/yyyy HH:mm:ss yyyy/MMM/dd HH:mm:ss MM-dd-yyyy dd-MM-yyyy yyyy-MM-dd MMM-dd-yyyy dd-MMM-yyyy yyyy-MMM-dd MM-dd-yyyy HH:mm:ss • • • • • • • • • • • • • • • • • • Functions and operators 341 Amazon QuickSight Date source type User Guide Supported date formats dd-MM-yyyy HH:mm:ss • • • • • • • • • • • • • • • • yyyy-MM-dd HH:mm:ss MMM-dd-yyyy HH:mm:ss dd-MMM-yyyy HH:mm:ss yyyy-MMM-dd HH:mm:ss MM/dd/yyyy HH:mm:ss.SSS dd/MM/yyyy HH:mm:ss.SSS yyyy/MM/dd HH:mm:ss.SSS MMM/dd/yyyy HH:mm:ss.SSS dd/MMM/yyyy HH:mm:ss.SSS yyyy/MMM/dd HH:mm:ss.SSS MM-dd-yyyy HH:mm:ss.SSS dd-MM-yyyy HH:mm:ss.SSS yyyy-MM-dd HH:mm:ss.SSS MMM-dd-yyyy HH:mm:ss.SSS dd-MMM-yyyy HH:mm:ss.SSS yyyy-MMM-dd HH:mm:ss.SSS Functions and operators 342 Amazon QuickSight User Guide Date source type Supported date formats Direct query of Snowflake dd/MM/yyyy dd/MM/yyyy HH:mm:ss dd-MM-yyyy dd-MM-yyyy HH:mm:ss MM/dd/yyyy MM/dd/yyyy HH:mm:ss MM-dd-yyyy MM-dd-yyyy HH:mm:ss yyyy/MM/dd yyyy/MM/dd HH:mm:ss yyyy-MM-dd yyyy-MM-dd HH:mm:ss MM/dd/yyyy HH:mm:ss.SSS dd/MM/yyyy HH:mm:ss.SSS yyyy/MM/dd HH:mm:ss.SSS MMM/dd/yyyy HH:mm:ss.SSS dd/MMM/yyyy HH:mm:ss.SSS yyyy/MMM/dd HH:mm:ss.SSS • • • • • • • • • • • • • • • • • • • Functions and operators 343 Amazon QuickSight User Guide Date source type Supported date formats MM-dd-yyyy HH:mm:ss.SSS dd-MM-yyyy HH:mm:ss.SSS yyyy-MM-dd HH:mm:ss.SSS MMM-dd-yyyy HH:mm:ss.SSS dd-MMM-yyyy HH:mm:ss.SSS yyyy-MMM-dd HH:mm:ss.SSS • • • • • Functions and operators 344 Amazon QuickSight User Guide Date source type Supported date formats Direct query of Microsoft SQL Server databases dd-MM-yyyy MM/dd/yyyy dd/MM/yyyy yyyy/MM/dd MMM/dd/yyyy dd/MMM/yyyy yyyy/MMM/dd dd/MM/yyyy HH:mm:ss yyyy/MM/dd HH:mm:ss MMM/dd/yyyy HH:mm:ss dd/MMM/yyyy HH:mm:ss yyyy/MMM/dd HH:mm:ss MM-dd-yyyy yyyy-MM-dd MMM-dd-yyyy yyyy-MMM-dd MM-dd-yyyy HH:mm:ss dd-MM-yyyy HH:mm:ss • • • • • • • • • • • • • • • • • • • Functions and operators 345 Amazon QuickSight Date source type User Guide Supported date formats yyyy-MM-dd HH:mm:ss • • • • • • • • • • • • • • • MMM-dd-yyyy HH:mm:ss dd-MMM-yyyy HH:mm:ss yyyy-MMM-dd HH:mm:ss MM/dd/yyyy HH:mm:ss.SSS dd/MM/yyyy HH:mm:ss.SSS yyyy/MM/dd HH:mm:ss.SSS MMM/dd/yyyy HH:mm:ss.SSS dd/MMM/yyyy HH:mm:ss.SSS yyyy/MMM/dd HH:mm:ss.SSS MM-dd-yyyy HH:mm:ss.SSS dd-MM-yyyy HH:mm:ss.SSS yyyy-MM-dd HH:mm:ss.SSS MMM-dd-yyyy HH:mm:ss.SSS dd-MMM-yyyy HH:mm:ss.SSS yyyy-MMM-dd HH:mm:ss.SSS Functions and operators 346 Amazon QuickSight
amazon-quicksight-user-108
amazon-quicksight-user.pdf
108
MMM/dd/yyyy HH:mm:ss dd/MMM/yyyy HH:mm:ss yyyy/MMM/dd HH:mm:ss MM-dd-yyyy yyyy-MM-dd MMM-dd-yyyy yyyy-MMM-dd MM-dd-yyyy HH:mm:ss dd-MM-yyyy HH:mm:ss • • • • • • • • • • • • • • • • • • • Functions and operators 345 Amazon QuickSight Date source type User Guide Supported date formats yyyy-MM-dd HH:mm:ss • • • • • • • • • • • • • • • MMM-dd-yyyy HH:mm:ss dd-MMM-yyyy HH:mm:ss yyyy-MMM-dd HH:mm:ss MM/dd/yyyy HH:mm:ss.SSS dd/MM/yyyy HH:mm:ss.SSS yyyy/MM/dd HH:mm:ss.SSS MMM/dd/yyyy HH:mm:ss.SSS dd/MMM/yyyy HH:mm:ss.SSS yyyy/MMM/dd HH:mm:ss.SSS MM-dd-yyyy HH:mm:ss.SSS dd-MM-yyyy HH:mm:ss.SSS yyyy-MM-dd HH:mm:ss.SSS MMM-dd-yyyy HH:mm:ss.SSS dd-MMM-yyyy HH:mm:ss.SSS yyyy-MMM-dd HH:mm:ss.SSS Functions and operators 346 Amazon QuickSight User Guide Date source type Supported date formats Direct query of Amazon Redshift or PostgreSQL databases Also, datasets from any DBMS that are stored in QuickSight SPICE MM/dd/yyyy dd/MM/yyyy yyyy/MM/dd MMM/dd/yyyy dd/MMM/yyyy yyyy/MMM/dd MM/dd/yyyy HH:mm:ss dd/MM/yyyy HH:mm:ss yyyy/MM/dd HH:mm:ss MMM/dd/yyyy HH:mm:ss dd/MMM/yyyy HH:mm:ss yyyy/MMM/dd HH:mm:ss MM-dd-yyyy dd-MM-yyyy yyyy-MM-dd MMM-dd-yyyy dd-MMM-yyyy yyyy-MMM-dd • • • • • • • • • • • • • • • • • • • Functions and operators 347 Amazon QuickSight Date source type User Guide Supported date formats MM-dd-yyyy HH:mm:ss dd-MM-yyyy HH:mm:ss yyyy-MM-dd HH:mm:ss MMM-dd-yyyy HH:mm:ss dd-MMM-yyyy HH:mm:ss yyyy-MMM-dd HH:mm:ss yyyyMMdd'T'HHmmss yyyy-MM-dd'T'HH:mm:ss MM/dd/yyyy HH:mm:ss.SSS dd/MM/yyyy HH:mm:ss.SSS yyyy/MM/dd HH:mm:ss.SSS MMM/dd/yyyy HH:mm:ss.SSS dd/MMM/yyyy HH:mm:ss.SSS yyyy/MMM/dd HH:mm:ss.SSS MM-dd-yyyy HH:mm:ss.SSS dd-MM-yyyy HH:mm:ss.SSS yyyy-MM-dd HH:mm:ss.SSS MMM-dd-yyyy HH:mm:ss.SSS • • • • • • • • • • • • • • • • • • Functions and operators 348 Amazon QuickSight User Guide Date source type Supported date formats dd-MMM-yyyy HH:mm:ss.SSS • yyyy-MMM-dd HH:mm:ss.SSS Return type Date Example The following example evaluates prodDate to determine if it contains date values. parseDate(prodDate, 'MM/dd/yyyy') The following are the given field values. prodDate -------- 01-01-1999 12/31/2006 1/18/1982 7/4/2010 For these field values, the following rows are returned. 12-31-2006T00:00:00.000Z 01-18-1982T00:00:00.000Z 07-04-2010T00:00:00.000Z parseDecimal parseDecimal parses a string to determine if it contains a decimal value. This function returns all rows that contain a decimal, integer, or null value, and skips any rows that don't. If the row contains an integer value, it is returned as a decimal with up to 4 decimal places. For example, a value of '2' is returned as '2.0'. Functions and operators 349 Amazon QuickSight Syntax parseDecimal(expression) Arguments expression User Guide The expression must be a string. It can be the name of a field that uses the string data type, a literal value like '9.62', or a call to another function that outputs a string. Return type Decimal Example The following example evaluates fee to determine if it contains decimal values. parseDecimal(fee) The following are the given field values. fee -------- 2 2a 12.13 3b 3.9 (null) 198.353398 For these field values, the following rows are returned. 2.0 12.13 3.9 (null) Functions and operators 350 Amazon QuickSight 198.3533 parseInt User Guide parseInt parses a string to determine if it contains an integer value. This function returns all rows that contain a decimal, integer, or null value, and skips any rows that don't. If the row contains a decimal value, it is returned as the nearest integer, rounded down. For example, a value of '2.99' is returned as '2'. Syntax parseInt(expression) Arguments expression The expression must be a string. It can be the name of a field that uses the string data type, a literal value like '3', or a call to another function that outputs a string. Return type Integer Example The following example evaluates feeType to determine if it contains integer values. parseInt(feeType) The following are the given field values. feeType -------- 2 2.1 2a 3 3b (null) Functions and operators 351 Amazon QuickSight 5 User Guide For these field values, the following rows are returned. 2 2 3 (null) 5 parseJson Use parseJson to extract values from a JSON object. If your dataset is stored in QuickSight SPICE, you can use parseJson when you are preparing a data set, but not in calculated fields during analysis. For direct query, you can use parseJson both during data preparation and analysis. The parseJson function applies to either strings or to JSON native data types, depending on the dialect, as shown in the following table. Dialect PostgreSQL Amazon Redshift Microsoft SQL Server MySQL Teradata Oracle Presto Snowflake Hive Type JSON String String JSON JSON String String Semistructured data type object and array String Functions and operators 352 Amazon QuickSight Syntax parseJson(fieldName, path) Arguments fieldName User Guide The field containing the JSON object that you want to parse. path The path to the data element you want to parse from the JSON object. Only letters, numbers, and blank spaces are supported in the path argument. Valid path syntax includes: • $ – Root object • . – Child operator • [ ] – Subscript operator for array Return type String Example The following example evaluates incoming JSON to retrieve a value
amazon-quicksight-user-109
amazon-quicksight-user.pdf
109
String String JSON JSON String String Semistructured data type object and array String Functions and operators 352 Amazon QuickSight Syntax parseJson(fieldName, path) Arguments fieldName User Guide The field containing the JSON object that you want to parse. path The path to the data element you want to parse from the JSON object. Only letters, numbers, and blank spaces are supported in the path argument. Valid path syntax includes: • $ – Root object • . – Child operator • [ ] – Subscript operator for array Return type String Example The following example evaluates incoming JSON to retrieve a value for item quantity. By using this during data preparation, you can create a table out of the JSON. parseJson({jsonField}, “$.items.qty”) The following shows the JSON. { "customer": "John Doe", "items": { "product": "Beer", "qty": 6 }, "list1": [ "val1", Functions and operators 353 User Guide Amazon QuickSight "val2" ], "list2": [ { "list21key1": "list1value1" } ] } For this example, the following value is returned. 6 Example The following example evaluates JSONObject1 to extract the first key value pair (KVP), labeled "State", and assign the value to the calculated field that you are creating. parseJson(JSONObject1, “$.state”) The following are the given field values. JSONObject1 ----------- {"State":"New York","Product":"Produce","Date Sold":"1/16/2018","Sales Amount":"$3423.39"} {"State":"North Carolina","Product":"Bakery Products","Date Sold":"2/1/2018","Sales Amount":"$3226.42"} {"State":"Utah","Product":"Water","Date Sold":"4/24/2018","Sales Amount":"$7001.52"} For these field values, the following rows are returned. New York North Carolina Utah Replace replace replaces part of a string with another string that you specify. Functions and operators 354 Amazon QuickSight Syntax replace(expression, substring, replacement) Arguments expression User Guide The expression must be a string. It can be the name of a field that uses the string data type, a literal value like '12 Main Street', or a call to another function that outputs a string. substring The set of characters in expression that you want to replace. The substring can occur one or more times in expression. replacement The string you want to have substituted for substring. Return type String Example The following example replaces the substring 'and' with 'or'. replace('1 and 2 and 3', 'and', 'or') The following string is returned. 1 or 2 or 3 Right right returns the rightmost characters from a string, including spaces. You specify the number of characters to be returned. Syntax right(expression, limit) Functions and operators 355 Amazon QuickSight Arguments expression User Guide The expression must be a string. It can be the name of a field that uses the string data type, a literal value like '12 Main Street', or a call to another function that outputs a string. limit The number of characters to be returned from expression, starting from the last character in the string. Return type String Example The following example returns the last five characters from a string. right('Seattle Store#14', 12) The following value is returned. tle Store#14 Round round rounds a decimal value to the closest integer if no scale is specified, or to the closest decimal place if scale is specified. Syntax round(decimal, scale) Arguments decimal A field that uses the decimal data type, a literal value like 17.62, or a call to another function that outputs a decimal. Functions and operators 356 Amazon QuickSight scale The number of decimal places to use for the return values. User Guide Return type Decimal Example The following example rounds a decimal field to the closest second decimal place. round(salesAmount, 2) The following are the given field values. 20.1307 892.0388 57.5447 For these field values, the following values are returned. 20.13 892.04 58.54 Rtrim rtrim removes following blank space from a string. Syntax rtrim(expression) Arguments expression The expression must be a string. It can be the name of a field that uses the string data type, a literal value like '12 Main Street', or a call to another function that outputs a string. Functions and operators 357 User Guide Amazon QuickSight Return type String Example The following example removes the following spaces from a string. rtrim('Seattle Store #14 ') For these field values, the following values are returned. Seattle Store #14 Split split splits a string into an array of substrings, based on a delimiter that you choose, and returns the item specified by the position. You can only add split to a calculated field during data preparation, not to an analysis. This function is not supported in direct queries to Microsoft SQL Server. Syntax split(expression, delimiter , position) Arguments expression The expression must be a string. It can be the name of a field that uses the string data type, a literal value like '12 Main Street;1402 35th Ave;1818 Elm Ct;11 Janes Lane', or a call to another function that outputs a string. delimiter The character that delimits where the string is broken into substrings. For example, split('one|two|three', '|', 2) becomes the following. one Functions and operators 358
amazon-quicksight-user-110
amazon-quicksight-user.pdf
110
add split to a calculated field during data preparation, not to an analysis. This function is not supported in direct queries to Microsoft SQL Server. Syntax split(expression, delimiter , position) Arguments expression The expression must be a string. It can be the name of a field that uses the string data type, a literal value like '12 Main Street;1402 35th Ave;1818 Elm Ct;11 Janes Lane', or a call to another function that outputs a string. delimiter The character that delimits where the string is broken into substrings. For example, split('one|two|three', '|', 2) becomes the following. one Functions and operators 358 Amazon QuickSight two three If you choose position = 2, split returns 'two'. position User Guide (Required) The position of the item to return from the array. The position of the first item in the array is 1. Return type String array Example The following example splits a string into an array, using the semicolon character (;) as the delimiter, and returns the third element of the array. split('123 Test St;1402 35th Ave;1818 Elm Ct;11 Janes Lane', ';', 3) The following item is returned. 1818 Elm Ct This function skips items containing null values or empty strings. Sqrt sqrt returns the square root of a given expression. Syntax sqrt(expression) Arguments expression The expression must be numeric. It can be a field name, a literal value, or another function. Functions and operators 359 Amazon QuickSight startsWith User Guide startsWith evaluates if the expression starts with a substring that you specify. If the expression starts with the substring, startsWith returns true, and otherwise it returns false. Syntax startsWith(expression, substring, string-comparison-mode) Arguments expression The expression must be a string. It can be the name of a field that uses the string data type, a literal value like '12 Main Street', or a call to another function that outputs a string. substring The set of characters to check against the expression. The substring can occur one or more times in the expression. string-comparison-mode (Optional) Specifies the string comparison mode to use: • CASE_SENSITIVE – String comparisons are case-sensitive. • CASE_INSENSITIVE – String comparisons are case-insensitive. This value defaults to CASE_SENSITIVE when blank. Return type Boolean Examples Default case sensitive example The following case sensitive example evaluates if state_nm startsWith New. startsWith(state_nm, "New") The following are the given field values. Functions and operators 360 Amazon QuickSight New York new york User Guide For these field values, the following values are returned. true false Case insensitive example The following case insensitive example evaluates if state_nm startsWith new. startsWith(state_nm, "new", CASE_INSENSITIVE) The following are the given field values. New York new york For these field values, the following values are returned. true true Example with conditional statements The startsWith function can be used as the conditional statement within the following If functions: avgIf, minIf, distinct_countIf, countIf, maxIf, medianIf, stdevIf, stdevpIf, sumIf, varIf, and varpIf. The following example sums Sales only if state_nm starts with New. sumIf(Sales,startsWith(state_nm, "New")) Does NOT contain example The conditional NOT operator can be used to evaluate if the expression does not start with the specified substring. NOT(startsWith(state_nm, "New")) Functions and operators 361 Amazon QuickSight Example using numeric values User Guide Numeric values can be used in the expression or substring arguments by applying the toString function. startsWith(state_nm, toString(5) ) Strlen strlen returns the number of characters in a string, including spaces. Syntax strlen(expression) Arguments expression An expression can be the name of a field that uses the string data type like address1, a literal value like 'Unknown', or another function like substring(field_name,0,5). Return type Integer Example The following example returns the length of the specified string. strlen('1421 Main Street') The following value is returned. 16 Substring substring returns the characters in a string, starting at the location specified by the start argument and proceeding for the number of characters specified by the length arguments. Functions and operators 362 Amazon QuickSight Syntax substring(expression, start, length) Arguments expression User Guide An expression can be the name of a field that uses the string data type like address1, a literal value like 'Unknown', or another function like substring(field_name,1,5). start The character location to start from. start is inclusive, so the character at the starting position is the first character in the returned value. The minimum value for start is 1. length The number of additional characters to include after start. length is inclusive of start, so the last character returned is (length - 1) after the starting character. Return type String Example The following example returns the 13th through 19th characters in a string. The beginning of the string is index 1, so you begin counting at the first character. substring('Fantasy and Science Fiction',13,7) The following value is returned. Science switch switch compares a condition-expression with the literal labels, within a set of literal label and
amazon-quicksight-user-111
amazon-quicksight-user.pdf
111
the first character in the returned value. The minimum value for start is 1. length The number of additional characters to include after start. length is inclusive of start, so the last character returned is (length - 1) after the starting character. Return type String Example The following example returns the 13th through 19th characters in a string. The beginning of the string is index 1, so you begin counting at the first character. substring('Fantasy and Science Fiction',13,7) The following value is returned. Science switch switch compares a condition-expression with the literal labels, within a set of literal label and return-expression pairings. It then returns the return-expression corresponding to the first literal label that's equal to the condition-expression. If no label equals to the condition-expression, switch Functions and operators 363 Amazon QuickSight User Guide returns the default-expression. Every return-expression and default-expression must have the same datatype. Syntax switch(condition-expression, label-1, return-expression-1 [, label-n, return- expression-n ...], default-expression) Arguments switch requires one or more if,then expression pairings, and requires exactly one expression for the else argument. condition-expression The expression to be compared with the label-literals. It can be a field name like address, a literal value like 'Unknown', or another scalar function like toString(salesAmount). label The literal to be compared with the condition-expression argument, all of the literals must have the same data type as condition-expression argument. switch accepts up to 5000 labels. return-expression The expression to return if the value of its label equals to the value of the condition-expression. It can be a field name like address, a literal value like 'Unknown', or another scalar function like toString(salesAmount). All of the return-expression arguments must have the same data type as the default-expression. default-expression The expression to return if no value of any label arguments equals to the value of condition- expression. It can be a field name like address, a literal value like 'Unknown', or another scalar function like toString(salesAmount). The default-expression must have the same data type as all of the return-expression arguments. Return type switch returns a value of the same data type as the values in return-expression. All data returned return-expression and default-expression must be of the same data type or be converted to the same data type. Functions and operators 364 Amazon QuickSight General Examples User Guide The following example returns the AWS Region code of input region name. switch(region_name, "US East (N. Virginia)", "us-east-1", "Europe (Ireland)", "eu-west-1", "US West (N. California)", "us-west-1", "other regions") The following are the given field values. "US East (N. Virginia)" "US West (N. California)" "Asia Pacific (Tokyo)" For these field values the following values are returned. "us-east-1" "us-west-1" "other regions" Use switch to replace ifelse The following ifelse use case is an equivalent of the previous example, for ifelse evaluating whether values of one field equals to different literal values, using switch instead is a better choice. ifelse(region_name = "US East (N. Virginia)", "us-east-1", region_name = "Europe (Ireland)", "eu-west-1", region_name = "US West (N. California)", "us-west-1", "other regions") Expression as return value The following example uses expressions in return-expressions: switch({origin_city_name}, "Albany, NY", {arr_delay} + 20, "Alexandria, LA", {arr_delay} - 10, Functions and operators 365 Amazon QuickSight User Guide "New York, NY", {arr_delay} * 2, {arr_delay}) The preceding example changes the expected delay time for each flight from a particular city. toLower toLower formats a string in all lowercase. toLower skips rows containing null values. Functions and operators 366 Amazon QuickSight Syntax toLower(expression) Arguments expression User Guide The expression must be a string. It can be the name of a field that uses the string data type, a literal value like '12 Main Street', or a call to another function that outputs a string. Return type String Example The following example converts a string value into lowercase. toLower('Seattle Store #14') The following value is returned. seattle store #14 toString toString formats the input expression as a string. toString skips rows containing null values. Syntax toString(expression) Arguments expression An expression can be a field of any data type, a literal value like 14.62, or a call to another function that returns any data type. Functions and operators 367 Amazon QuickSight Return type String Example User Guide The following example returns the values from payDate (which uses the date data type) as strings. toString(payDate) The following are the given field values. payDate -------- 1992-11-14T00:00:00.000Z 2012-10-12T00:00:00.000Z 1973-04-08T00:00:00.000Z For these field values, the following rows are returned. 1992-11-14T00:00:00.000Z 2012-10-12T00:00:00.000Z 1973-04-08T00:00:00.000Z toUpper toUpper formats a string in all uppercase. toUpper skips rows containing null values. Syntax toUpper(expression) Arguments expression The expression must be a string. It can be the name of a field that uses the string data type, a literal value like '12 Main Street', or a call to another function that outputs a string. Functions and operators 368 User Guide Amazon QuickSight Return type
amazon-quicksight-user-112
amazon-quicksight-user.pdf
112
from payDate (which uses the date data type) as strings. toString(payDate) The following are the given field values. payDate -------- 1992-11-14T00:00:00.000Z 2012-10-12T00:00:00.000Z 1973-04-08T00:00:00.000Z For these field values, the following rows are returned. 1992-11-14T00:00:00.000Z 2012-10-12T00:00:00.000Z 1973-04-08T00:00:00.000Z toUpper toUpper formats a string in all uppercase. toUpper skips rows containing null values. Syntax toUpper(expression) Arguments expression The expression must be a string. It can be the name of a field that uses the string data type, a literal value like '12 Main Street', or a call to another function that outputs a string. Functions and operators 368 User Guide Amazon QuickSight Return type String Example The following example converts a string value into uppercase. toUpper('Seattle Store #14') The following value is returned. SEATTLE STORE #14 trim trim removes both preceding and following blank space from a string. Syntax trim(expression) Arguments expression The expression must be a string. It can be the name of a field that uses the string data type, a literal value like '12 Main Street', or a call to another function that outputs a string. Return type String Example The following example removes the following spaces from a string. trim(' Seattle Store #14 ') For these field values, the following values are returned. Functions and operators 369 Amazon QuickSight Seattle Store #14 truncDate User Guide truncDate returns a date value that represents a specified portion of a date. For example, requesting the year portion of the value 2012-09-02T00:00:00.000Z returns 2012-01-01T00:00:00.000Z. Specifying a time-related period for a date that doesn't contain time information returns the initial date value unchanged. Syntax truncDate('period', date) Arguments period The period of the date that you want returned. Valid periods are as follows: • YYYY: This returns the year portion of the date. • Q: This returns the date of the first day of the quarter that the date belongs to. • MM: This returns the month portion of the date. • DD: This returns the day portion of the date. • WK: This returns the week portion of the date. The week starts on Sunday in Amazon QuickSight. • HH: This returns the hour portion of the date. • MI: This returns the minute portion of the date. • SS: This returns the second portion of the date. • MS: This returns the millisecond portion of the date. date A date field or a call to another function that outputs a date. Return type Date Functions and operators 370 Amazon QuickSight Example User Guide The following example returns a date representing the month of the order date. truncDate('MM', orderDate) The following are the given field values. orderDate ========= 2012-12-14T00:00:00.000Z 2013-12-29T00:00:00.000Z 2012-11-15T00:00:00.000Z For these field values, the following values are returned. 2012-12-01T00:00:00.000Z 2013-12-01T00:00:00.000Z 2012-11-01T00:00:00.000Z Aggregate functions Aggregate functions are only available during analysis and visualization. Each of these functions returns values grouped by the chosen dimension or dimensions. For each aggregation, there is also a conditional aggregation. These perform the same type of aggregation, based on a condition. When a calculated field formula contains an aggregation, it becomes a custom aggregation. To make sure that your data is accurately displayed, Amazon QuickSight applies the following rules: • Custom aggregations can't contain nested aggregate functions. For example, this formula doesn't work: sum(avg(x)/avg(y)). However, nesting nonaggregated functions inside or outside aggregate functions does work. For example, ceil(avg(x)) works. So does avg(ceil(x)). • Custom aggregations can't contain both aggregated and nonaggregated fields, in any combination. For example, this formula doesn't work: Sum(sales)+quantity. • Filter groups can't contain both aggregated and nonaggregated fields. • Custom aggregations can't be converted to a dimension. They also can't be dropped into the field well as a dimension. • In a pivot table, custom aggregations can't be added to table calculations. Functions and operators 371 Amazon QuickSight User Guide • Scatter plots with custom aggregations need at least one dimension under Group/Color in the field wells. For more information about supported functions and operators, see Calculated field function and operator reference for Amazon QuickSight . The aggregate functions for calculated fields in QuickSight include the following. Topics • avg • avgIf • count • countIf • distinct_count • distinct_countIf • max • maxIf • median • medianIf • min • minIf • percentile • percentileCont • percentileDisc (percentile) • periodToDateAvg • periodToDateCount • periodToDateMax • periodToDateMedian • periodToDateMin • periodToDatePercentile • periodToDatePercentileCont • periodToDateStDev Functions and operators 372 User Guide Amazon QuickSight • periodToDateStDevP • periodToDateSum • periodToDateVar • periodToDateVarP • stdev • stdevp • stdevIf • stdevpIf • sum • sumIf • var • varIf • varp • varpIf avg The avg function averages the set of numbers in the specified measure, grouped by the chosen dimension or dimensions. For example, avg(salesAmount) returns the average for that measure grouped by the (optional) chosen dimension. Syntax avg(decimal, [group-by level]) Arguments decimal The argument must
amazon-quicksight-user-113
amazon-quicksight-user.pdf
113
percentileCont • percentileDisc (percentile) • periodToDateAvg • periodToDateCount • periodToDateMax • periodToDateMedian • periodToDateMin • periodToDatePercentile • periodToDatePercentileCont • periodToDateStDev Functions and operators 372 User Guide Amazon QuickSight • periodToDateStDevP • periodToDateSum • periodToDateVar • periodToDateVarP • stdev • stdevp • stdevIf • stdevpIf • sum • sumIf • var • varIf • varp • varpIf avg The avg function averages the set of numbers in the specified measure, grouped by the chosen dimension or dimensions. For example, avg(salesAmount) returns the average for that measure grouped by the (optional) chosen dimension. Syntax avg(decimal, [group-by level]) Arguments decimal The argument must be a measure. Null values are omitted from the results. Literal values don't work. The argument must be a field. group-by level (Optional) Specifies the level to group the aggregation by. The level added can be any dimension or dimensions independent of the dimensions added to the visual. Functions and operators 373 Amazon QuickSight User Guide The argument must be a dimension field. The group-by level must be enclosed in square brackets [ ]. For more information, see LAC-A functions. Examples The following example calculates the average sales. avg({Sales}) You can also specify at what level to group the computation using one or more dimensions in the view or in your dataset. This is called a LAC-A function. For more information about LAC-A functions, see LAC-A functions. The following example calculates the average sales at the Country level, but not across other dimensions (Region or Product) in the visual. avg({Sales}, [{Country}]) Functions and operators 374 Amazon QuickSight avgIf User Guide Based on a conditional statement, the avgIf function averages the set of numbers in the specified measure, grouped by the chosen dimension or dimensions. For example, avgIf(ProdRev,CalendarDay >= ${BasePeriodStartDate} AND CalendarDay <= ${BasePeriodEndDate} AND SourcingType <> 'Indirect') returns the average for that measure grouped by the (optional) chosen dimension, if the condition evaluates to true. Syntax avgIf(dimension or measure, condition) Arguments decimal The argument must be a measure. Null values are omitted from the results. Literal values don't work. The argument must be a field. condition One or more conditions in a single statement. count The count function calculates the number of values in a dimension or measure, grouped by the chosen dimension or dimensions. For example, count(product type) returns the total number of product types grouped by the (optional) chosen dimension, including any duplicates. The count(sales) function returns the total number of sales completed grouped by the (optional) chosen dimension, for example salesperson. Syntax count(dimension or measure, [group-by level]) Arguments dimension or measure The argument must be a measure or a dimension. Null values are omitted from the results. Literal values don't work. The argument must be a field. Functions and operators 375 Amazon QuickSight group-by level User Guide (Optional) Specifies the level to group the aggregation by. The level added can be any dimension or dimensions independent of the dimensions added to the visual. The argument must be a dimension field. The group-by level must be enclosed in square brackets [ ]. For more information, see LAC-A functions. Examples The following example calculates the count of sales by a specified dimension in the visual. In this example, the count of sales by month are shown. count({Sales}) You can also specify at what level to group the computation using one or more dimensions in the view or in your dataset. This is called a LAC-A function. For more information about LAC-A functions, see LAC-A functions. The following example calculates the count of sales at the Country level, but not across other dimensions (Region or Product) in the visual. count({Sales}, [{Country}]) Functions and operators 376 Amazon QuickSight User Guide countIf Based on a conditional statement, the countIf function calculates the number of values in a dimension or measure, grouped by the chosen dimension or dimensions. Syntax countIf(dimension or measure, condition) Arguments dimension or measure The argument must be a measure or a dimension. Null values are omitted from the results. Literal values don't work. The argument must be a field. condition One or more conditions in a single statement. Functions and operators 377 Amazon QuickSight Return type Integer Example User Guide The following function returns a count of the sales transactions (Revenue) that meet the conditions, including any duplicates. countIf ( Revenue, # Conditions CalendarDay >= ${BasePeriodStartDate} AND CalendarDay <= ${BasePeriodEndDate} AND SourcingType <> 'Indirect' ) distinct_count The distinct_count function calculates the number of distinct values in a dimension or measure, grouped by the chosen dimension or dimensions. For example, distinct_count(product type) returns the total number of unique product types grouped by the (optional) chosen dimension, without any duplicates. The distinct_count(ship date) function returns the total number of dates when products were shipped grouped by the (optional) chosen dimension, for example region. Syntax distinct_count(dimension or measure, [group-by level]) Arguments dimension
amazon-quicksight-user-114
amazon-quicksight-user.pdf
114
transactions (Revenue) that meet the conditions, including any duplicates. countIf ( Revenue, # Conditions CalendarDay >= ${BasePeriodStartDate} AND CalendarDay <= ${BasePeriodEndDate} AND SourcingType <> 'Indirect' ) distinct_count The distinct_count function calculates the number of distinct values in a dimension or measure, grouped by the chosen dimension or dimensions. For example, distinct_count(product type) returns the total number of unique product types grouped by the (optional) chosen dimension, without any duplicates. The distinct_count(ship date) function returns the total number of dates when products were shipped grouped by the (optional) chosen dimension, for example region. Syntax distinct_count(dimension or measure, [group-by level]) Arguments dimension or measure The argument must be a measure or a dimension. Null values are omitted from the results. Literal values don't work. The argument must be a field. group-by level (Optional) Specifies the level to group the aggregation by. The level added can be any dimension or dimensions independent of the dimensions added to the visual. Functions and operators 378 Amazon QuickSight User Guide The argument must be a dimension field. The group-by level must be enclosed in square brackets [ ]. For more information, see LAC-A functions. Example The following example calculates the total number of dates when products were ordered grouped by the (optional) chosen dimension in the visual, for example region. distinct_count({Order Date}) You can also specify at what level to group the computation using one or more dimensions in the view or in your dataset. This is called a LAC-A function. For more information about LAC-A functions, see LAC-A functions. The following example calculates the average sales at the Country level, but not across other dimensions (Region) in the visual. distinct_count({Order Date}, [Country]) Functions and operators 379 Amazon QuickSight User Guide distinct_countIf Based on a conditional statement, the distinct_countIf function calculates the number of distinct values in a dimension or measure, grouped by the chosen dimension or dimensions. For example, distinct_countIf(product type) returns the total number of unique product types grouped by the (optional) chosen dimension, without any duplicates. The distinct_countIf(ProdRev,CalendarDay >= ${BasePeriodStartDate} AND CalendarDay <= ${BasePeriodEndDate} AND SourcingType <> 'Indirect') function returns the total number of dates when products were shipped grouped by the (optional) chosen dimension, for example region, if the condition evaluates to true. Syntax distinct_countIf(dimension or measure, condition) Arguments dimension or measure The argument must be a measure or a dimension. Null values are omitted from the results. Literal values don't work. The argument must be a field. condition One or more conditions in a single statement. max The max function returns the maximum value of the specified measure or date, grouped by the chosen dimension or dimensions. For example, max(sales goal) returns the maximum sales goals grouped by the (optional) chosen dimension. Functions and operators 380 Amazon QuickSight Syntax max(measure, [group-by level]) Arguments measure User Guide The argument must be a measure or a date. Null values are omitted from the results. Literal values don't work. The argument must be a field. Maximum dates work only in the Value field well of tables and pivot tables. group-by level (Optional) Specifies the level to group the aggregation by. The level added can be any dimension or dimensions independent of the dimensions added to the visual. The argument must be a dimension field. The group-by level must be enclosed in square brackets [ ]. For more information, see LAC-A functions. Examples The following example returns the max sales value for each region. It is compared to the total, minimum, and median sales values. max({Sales}) Functions and operators 381 Amazon QuickSight User Guide You can also specify at what level to group the computation using one or more dimensions in the view or in your dataset. This is called a LAC-A function. For more information about LAC-A functions, see LAC-A functions. The following example calculates the max sales at the Country level, but not across other dimensions (Region) in the visual. max({Sales}, [Country]) Functions and operators 382 Amazon QuickSight maxIf User Guide Based on a conditional statement, the maxIf function returns the maximum value of the specified measure, grouped by the chosen dimension or dimensions. For example, maxIf(ProdRev,CalendarDay >= ${BasePeriodStartDate} AND CalendarDay <= ${BasePeriodEndDate} AND SourcingType <> 'Indirect') returns the maximum sales goals grouped by the (optional) chosen dimension, if the condition evaluates to true. Syntax maxIf(measure, condition) Arguments measure The argument must be a measure. Null values are omitted from the results. Literal values don't work. The argument must be a field. condition One or more conditions in a single statement. median The median aggregation returns the median value of the specified measure, grouped by the chosen dimension or dimensions. For example, median(revenue) returns the median revenue grouped by the (optional) chosen dimension. Syntax median(measure, [group-by level]) Arguments measure The argument must be a measure. Null values are omitted from the results. Literal
amazon-quicksight-user-115
amazon-quicksight-user.pdf
115
by the (optional) chosen dimension, if the condition evaluates to true. Syntax maxIf(measure, condition) Arguments measure The argument must be a measure. Null values are omitted from the results. Literal values don't work. The argument must be a field. condition One or more conditions in a single statement. median The median aggregation returns the median value of the specified measure, grouped by the chosen dimension or dimensions. For example, median(revenue) returns the median revenue grouped by the (optional) chosen dimension. Syntax median(measure, [group-by level]) Arguments measure The argument must be a measure. Null values are omitted from the results. Literal values don't work. The argument must be a field. Functions and operators 383 Amazon QuickSight group-by level User Guide (Optional) Specifies the level to group the aggregation by. The level added can be any dimension or dimensions independent of the dimensions added to the visual. The argument must be a dimension field. The group-by level must be enclosed in square brackets [ ]. For more information, see LAC-A functions. Examples The following example returns the median sales value for each region. It is compared to the total, maximum, and minimum sales. median({Sales}) You can also specify at what level to group the computation using one or more dimensions in the view or in your dataset. This is called a LAC-A function. For more information about LAC-A Functions and operators 384 Amazon QuickSight User Guide functions, see LAC-A functions. The following example calculates the median sales at the Country level, but not across other dimensions (Region) in the visual. median({Sales}, [Country]) medianIf Based on a conditional statement, the medianIf aggregation returns the median value of the specified measure, grouped by the chosen dimension or dimensions. For example, medianIf(Revenue,SaleDate >= ${BasePeriodStartDate} AND SaleDate <= ${BasePeriodEndDate}) returns the median revenue grouped by the (optional) chosen dimension, if the condition evaluates to true. Syntax medianIf(measure, condition) Arguments measure The argument must be a measure. Null values are omitted from the results. Literal values don't work. The argument must be a field. condition One or more conditions in a single statement. min The min function returns the minimum value of the specified measure or date, grouped by the chosen dimension or dimensions. For example, min(return rate) returns the minimum rate of returns grouped by the (optional) chosen dimension. Functions and operators 385 Amazon QuickSight Syntax min(measure, [group-by level]) Arguments measure User Guide The argument must be a measure or a date. Null values are omitted from the results. Literal values don't work. The argument must be a field. Minimum dates work only in the Value field well of tables and pivot tables. group-by level (Optional) Specifies the level to group the aggregation by. The level added can be any dimension or dimensions independent of the dimensions added to the visual. The argument must be a dimension field. The group-by level must be enclosed in square brackets [ ]. For more information, see LAC-A functions. Examples The following example returns the minimum sales value for each region. It is compared to the total, max, and median sales. min({Sales}) Functions and operators 386 Amazon QuickSight User Guide You can also specify at what level to group the computation using one or more dimensions in the view or in your dataset. This is called a LAC-A function. For more information about LAC- A functions, see LAC-A functions. The following example calculates the minimum sales at the Country level, but not across other dimensions (Region) in the visual. min({Sales}, [Country]) Functions and operators 387 Amazon QuickSight minIf User Guide Based on a conditional statement, the minIf function returns the minimum value of the specified measure, grouped by the chosen dimension or dimensions. For example, minIf(ProdRev,CalendarDay >= ${BasePeriodStartDate} AND CalendarDay <= ${BasePeriodEndDate} AND SourcingType <> 'Indirect') returns the minimum rate of returns grouped by the (optional) chosen dimension, if the condition evaluates to true. Syntax minIf(measure, condition) Arguments measure The argument must be a measure. Null values are omitted from the results. Literal values don't work. The argument must be a field. condition One or more conditions in a single statement. percentile The percentile function calculates the percentile of the values in measure, grouped by the dimension that's in the field well. There are two varieties of percentile calculation available in QuickSight: • percentileCont uses linear interpolation to determine result. • percentileDisc (percentile) uses actual values to determine result. The percentile function is an alias of percentileDisc. percentileCont The percentileCont function calculates percentile based on a continuous distribution of the numbers in the measure. It uses the grouping and sorting that are applied in the field wells. It answers questions like: What values are representative of this percentile? To return an exact Functions and operators 388 Amazon QuickSight User Guide percentile value that might not be present in your dataset,
amazon-quicksight-user-116
amazon-quicksight-user.pdf
116
field well. There are two varieties of percentile calculation available in QuickSight: • percentileCont uses linear interpolation to determine result. • percentileDisc (percentile) uses actual values to determine result. The percentile function is an alias of percentileDisc. percentileCont The percentileCont function calculates percentile based on a continuous distribution of the numbers in the measure. It uses the grouping and sorting that are applied in the field wells. It answers questions like: What values are representative of this percentile? To return an exact Functions and operators 388 Amazon QuickSight User Guide percentile value that might not be present in your dataset, use percentileCont. To return the nearest percentile value that is present in your dataset, use percentileDisc instead. Syntax percentileCont(expression, percentile, [group-by level]) Arguments measure Specifies a numeric value to use to compute the percentile. The argument must be a measure or metric. Nulls are ignored in the calculation. percentile The percentile value can be any numeric constant 0–100. A percentile value of 50 computes the median value of the measure. group-by level (Optional) Specifies the level to group the aggregation by. The level added can be any dimension or dimensions independent of the dimensions added to the visual. The argument must be a dimension field. The group-by level must be enclosed in square brackets [ ]. For more information, see LAC-A functions. Returns The result of the function is a number. Usage notes The percentileCont function calculates a result based on a continuous distribution of the values from a specified measure. The result is computed by linear interpolation between the values after ordering them based on settings in the visual. It's different from percentileDisc, which simply returns a value from the set of values that are aggregated over. The result from percentileCont might or might not exist in the values from the specified measure. Examples of percentileCont The following examples help explain how percentileCont works. Functions and operators 389 Amazon QuickSight User Guide Example Comparing median, percentileCont, and percentileDisc The following example shows the median for a dimension (category) by using the median, percentileCont, and percentileDisc functions. The median value is the same as the percentileCont value. percentileCont interpolates a value, which might or might not be in the data set. However, because percentileDisc always displays a value that exists in the dataset, the two results might not match. The last column in this example shows the difference between the two values. The code for each calculated field is as follows: • 50%Cont = percentileCont( example , 50 ) • median = median( example ) • 50%Disc = percentileDisc( example , 50 ) • Cont-Disc = percentileCont( example , 50 ) − percentileDisc( example , 50 ) • example = left( category, 1 ) (To make a simpler example, we used this expression to shorten the names of categories down to their first letter.) example median 50%Cont 50%Disc Cont-Disc -------- ----------- ------------ -------------- ------------ A 22.48 22.48 22.24 0.24 B 20.96 20.96 20.95 0.01 C 24.92 24.92 24.92 0 D 24.935 24.935 24.92 0.015 E 14.48 14.48 13.99 0.49 Example 100th percentile as maximum The following example shows a variety of percentileCont values for the example field. The calculated fields n%Cont are defined as percentileCont( {example} ,n). The interpolated values in each column represent the numbers that fall into that percentile bucket. In some cases, the actual data values match the interpolated values. For example, the column 100%Cont shows the same value for every row because 6783.02 is the highest number. example 50%Cont 75%Cont 99%Cont 100%Cont --------- ----------- ----------- ------------ ----------- A 20.97 84.307 699.99 6783.02 B 20.99 88.84 880.98 6783.02 Functions and operators 390 Amazon QuickSight User Guide C 20.99 90.48 842.925 6783.02 D 21.38 85.99 808.49 6783.02 You can also specify at what level to group the computation using one or more dimensions in the view or in your dataset. This is called a LAC-A function. For more information about LAC-A functions, see LAC-A functions. The following example calculates the 30th percentile based on a continuous distribution of the numbers at the Country level, but not across other dimensions (Region) in the visual. percentileCont({Sales}, 30, [Country]) percentileDisc (percentile) The percentileDisc function calculates the percentile based on the actual numbers in measure. It uses the grouping and sorting that are applied in the field wells. The percentile function is an alias of percentileDisc. Use this function to answer the following question: Which actual data points are present in this percentile? To return the nearest percentile value that is present in your dataset, use percentileDisc. To return an exact percentile value that might not be present in your dataset, use percentileCont instead. Syntax percentileDisc(expression, percentile, [group-by level]) Arguments measure Specifies a numeric value to use to compute the percentile. The argument must be a measure or metric. Nulls are ignored
amazon-quicksight-user-117
amazon-quicksight-user.pdf
117
numbers in measure. It uses the grouping and sorting that are applied in the field wells. The percentile function is an alias of percentileDisc. Use this function to answer the following question: Which actual data points are present in this percentile? To return the nearest percentile value that is present in your dataset, use percentileDisc. To return an exact percentile value that might not be present in your dataset, use percentileCont instead. Syntax percentileDisc(expression, percentile, [group-by level]) Arguments measure Specifies a numeric value to use to compute the percentile. The argument must be a measure or metric. Nulls are ignored in the calculation. Functions and operators 391 Amazon QuickSight percentile User Guide The percentile value can be any numeric constant 0–100. A percentile value of 50 computes the median value of the measure. group-by level (Optional) Specifies the level to group the aggregation by. The level added can be any dimension or dimensions independent of the dimensions added to the visual. The argument must be a dimension field. The group-by level must be enclosed in square brackets [ ]. For more information, see LAC-A functions. Returns The result of the function is a number. Usage notes percentileDisc is an inverse distribution function that assumes a discrete distribution model. It takes a percentile value and a sort specification and returns an element from the given set. For a given percentile value P, percentileDisc uses the sorted values in the visual and returns the value with the smallest cumulative distribution value that is greater than or equal to P. Examples of percentileDisc The following examples help explain how percentileDisc works. Example Comparing median, percentileDisc, and percentileCont The following example shows the median for a dimension (category) by using the percentileCont, and percentileDisc, and median functions. The median value is the same as the percentileCont value. percentileCont interpolates a value, which might or might not be in the data set. However, because percentileDisc always displays the closest value that exists in the dataset, the two results might not match. The last column in this example shows the difference between the two values. The code for each calculated field is as follows: • 50%Cont = percentileCont( example , 50 ) • median = median( example ) Functions and operators 392 Amazon QuickSight User Guide • 50%Disc = percentileDisc( example , 50 ) • Cont-Disc = percentileCont( example , 50 ) − percentileDisc( example , 50 ) • example = left( category, 1 ) (To make a simpler example, we used this expression to shorten the names of categories down to their first letter.) example median 50%Cont 50%Disc Cont-Disc -------- ----------- ------------ -------------- ------------ A 22.48 22.48 22.24 0.24 B 20.96 20.96 20.95 0.01 C 24.92 24.92 24.92 0 D 24.935 24.935 24.92 0.015 E 14.48 14.48 13.99 0.49 Example 100th percentile as maximum The following example shows a variety of percentileDisc values for the example field. The calculated fields n%Disc are defined as percentileDisc( {example} ,n). The values in each column are actual numbers that come from the dataset. example 50%Disc 75%Disc 99%Disc 100%Disc -------- ----------- ------------ -------------- ------------ A 20.97 73.98 699.99 6783.02 B 42.19 88.84 820.08 6783.02 C 30.52 90.48 733.44 6783.02 D 41.38 85.99 901.29 6783.0 You can also specify at what level to group the computation using one or more dimensions in the view or in your dataset. This is called a LAC-A function. For more information about LAC-A functions, see LAC-A functions. The following example calculates the 30th percentile based on a continuous distribution of the numbers at the Country level, but not across other dimensions (Region) in the visual. percentile({Sales}, 30, [Country]) Functions and operators 393 Amazon QuickSight User Guide periodToDateAvg The periodToDateAvg function averages the set of numbers in the specified measure for a given time granularity (for instance, a quarter) up to a point in time, relative to that period. Syntax periodToDateAvg( measure, dateTime, period, endDate (optional)) Arguments measure The argument must be a field. Null values are omitted from the results. Literal values don't work. dateTime The Date dimension over which you're computing PeriodToDate aggregations. period The time period across which you're computing the computation. Granularity of YEAR means YearToDate computation, Quarter means QuarterToDate, and so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. endDate (Optional) The date dimension that you're ending computing periodToDate aggregations. It defaults to now() if omitted. Functions and operators 394 Amazon QuickSight Example User Guide The following example calculates the week-to-date minimum fare amount per payment type, for the week of 06-30-21. For simplicity in the example, we filtered out only a single payment. 06-30-21 is Wednesday. QuickSight begins the week on Sundays. In our example, that is 06-27-21. periodToDateAvg(fare_amount, pickUpDatetime, WEEK, parseDate("06-30-2021", "MM-dd- yyyy")) periodToDateCount The periodToDateCount function calculates the number of values in
amazon-quicksight-user-118
amazon-quicksight-user.pdf
118
so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. endDate (Optional) The date dimension that you're ending computing periodToDate aggregations. It defaults to now() if omitted. Functions and operators 394 Amazon QuickSight Example User Guide The following example calculates the week-to-date minimum fare amount per payment type, for the week of 06-30-21. For simplicity in the example, we filtered out only a single payment. 06-30-21 is Wednesday. QuickSight begins the week on Sundays. In our example, that is 06-27-21. periodToDateAvg(fare_amount, pickUpDatetime, WEEK, parseDate("06-30-2021", "MM-dd- yyyy")) periodToDateCount The periodToDateCount function calculates the number of values in a dimension or measure, including duplicates, for a given time granularity (for instance, a quarter) up to a point in time, relative to that period. Functions and operators 395 User Guide Amazon QuickSight Syntax periodToDateCount( measure, dateTime, period, endDate (optional)) Arguments measure The argument must be a field. Null values are omitted from the results. Literal values don't work. dateTime The Date dimension over which you're computing PeriodToDate aggregations. period The time period across which you're computing the computation. Granularity of YEAR means YearToDate computation, Quarter means QuarterToDate, and so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. endDate (Optional) The date dimension that you're ending computing periodToDate aggregations. It defaults to now() if omitted. Example The following example calculates the week-to-date minimum fare amount per payment type, for the week of 06-30-21. For simplicity in the example, we filtered out only a single payment. 06-30-21 is Wednesday. QuickSight begins the week on Sundays. In our example, that is 06-27-21. periodToDateCount(fare_amount, pickUpDatetime, WEEK, parseDate("06-30-2021", "MM-dd- yyyy")) Functions and operators 396 Amazon QuickSight User Guide periodToDateMax The periodToDateMax function returns the maximum value of the specified measure for a given time granularity (for instance, a quarter) up to a point in time, relative to that point. Syntax periodToDateMax( measure, dateTime, period, endDate (optional)) Functions and operators 397 Amazon QuickSight Arguments measure User Guide The argument must be a field. Null values are omitted from the results. Literal values don't work. dateTime The Date dimension over which you're computing PeriodToDate aggregations. period The time period across which you're computing the computation. Granularity of YEAR means YearToDate computation, Quarter means QuarterToDate, and so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. endDate (Optional) The date dimension that you're ending computing periodToDate aggregations. It defaults to now() if omitted. Example The following example calculates the week-to-date minimum fare amount per payment type, for the week of 06-30-21. For simplicity in the example, we filtered out only a single payment. 06-30-21 is Wednesday. QuickSight begins the week on Sundays. In our example, that is 06-27-21. periodToDateMax(fare_amount, pickUpDatetime, WEEK, parseDate("06-30-2021", "MM-dd- yyyy")) Functions and operators 398 Amazon QuickSight User Guide periodToDateMedian The periodToDateMedian function returns the median value of the specified measure for a given time granularity (for instance, a quarter) up to a point in time, relative to that period. Syntax periodToDateMedian( measure, dateTime, period, endDate (optional)) Functions and operators 399 Amazon QuickSight Arguments measure User Guide The argument must be a field. Null values are omitted from the results. Literal values don't work. dateTime The Date dimension over which you're computing PeriodToDate aggregations. period The time period across which you're computing the computation. Granularity of YEAR means YearToDate computation, Quarter means QuarterToDate, and so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. endDate (Optional) The date dimension that you're ending computing periodToDate aggregations. It defaults to now() if omitted. Example The following example calculates the week-to-date minimum fare amount per payment type, for the week of 06-30-21. For simplicity in the example, we filtered out only a single payment. 06-30-21 is Wednesday. QuickSight begins the week on Sundays. In our example, that is 06-27-21. periodToDateMedian(fare_amount, pickUpDatetime, WEEK, parseDate("06-30-2021", "MM-dd- yyyy")) Functions and operators 400 Amazon QuickSight User Guide periodToDateMin The periodToDateMin function returns the minimum value of the specified measure or date, or a given time granularity (for instance, a quarter) up to a point in time, relative to that period. Syntax periodToDateMin( measure, dateTime, period, endDate (optional)) Functions and operators 401 Amazon QuickSight Arguments measure User Guide The argument must be a field. Null values are omitted from the results. Literal values don't work. dateTime The Date dimension over which you're computing PeriodToDate aggregations. period The time period across which you're computing the computation. Granularity of YEAR means YearToDate computation, Quarter means QuarterToDate, and so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. endDate (Optional) The date dimension that you're ending computing periodToDate aggregations. It defaults to now() if omitted. Example The following example calculates the week-to-date minimum fare amount per payment type, for the week of 06-30-21. For simplicity in the example,
amazon-quicksight-user-119
amazon-quicksight-user.pdf
119
argument must be a field. Null values are omitted from the results. Literal values don't work. dateTime The Date dimension over which you're computing PeriodToDate aggregations. period The time period across which you're computing the computation. Granularity of YEAR means YearToDate computation, Quarter means QuarterToDate, and so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. endDate (Optional) The date dimension that you're ending computing periodToDate aggregations. It defaults to now() if omitted. Example The following example calculates the week-to-date minimum fare amount per payment type, for the week of 06-30-21. For simplicity in the example, we filtered out only a single payment. 06-30-21 is Wednesday. QuickSight begins the week on Sundays. In our example, that is 06-27-21. periodToDateMin(fare_amount, pickUpDatetime, WEEK, parseDate("06-30-2021", "MM-dd- yyyy")) Functions and operators 402 Amazon QuickSight User Guide periodToDatePercentile The periodToDatePercentile function calculates the percentile based on the actual numbers in measure for a given time granularity (for instance, a quarter) up to a point in time, relative to that period. It uses the grouping and sorting that are applied in the field wells. To return the nearest percentile value that is present in your dataset, use periodToDatePercentile. To return an exact percentile value that might not be present in your dataset, use periodToDatePercentileCont instead. Syntax periodToDatePercentile( measure, Functions and operators 403 Amazon QuickSight percentile, dateTime, period, endDate (optional)) Arguments measure User Guide The argument must be a field. Null values are omitted from the results. Literal values don't work. percentile The percentile value can be any numeric constant 0-100. A percentile of 50 computes the median value of the measure. dateTime The Date dimension over which you're computing PeriodToDate aggregations. period The time period across which you're computing the computation. Granularity of YEAR means YearToDate computation, Quarter means QuarterToDate, and so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. endDate (Optional) The date dimension that you're ending computing periodToDate aggregations. It defaults to now() if omitted. Example The following example calculates the week-to-date, 90th percentile of fare amount per payment type for the week of 06-30-21. For simplicity in the example, we filtered out only a single payment. 06-30-21 is Wednesday. QuickSight begins the week on Sundays. In our example. that is 06-27-21. periodToDatePercentile(fare_amount, 90, pickupDatetime, WEEK, parseDate("06-30-2021", "MM-dd-yyyy")) Functions and operators 404 Amazon QuickSight User Guide periodToDatePercentileCont The periodToDatePercentileCont function calculates percentile based on a continuous distribution of the numbers in the measure for a given time granularity (for instance, a quarter) up to a point in time in that period. It uses the grouping and sorting that are applied in the field wells. To return an exact percentile value that might not be present in your dataset, use periodToDatePercentileCont. To return the nearest percentile value that is present in your dataset, use periodToDatePercentile instead. Syntax periodToDatePercentileCont( measure, Functions and operators 405 Amazon QuickSight percentile, dateTime, period, endDate (optional)) Arguments measure User Guide The argument must be a field. Null values are omitted from the results. Literal values don't work. percentile The percentile value can be any numeric constant 0-100. A percentile of 50 computes the median value of the measure. dateTime The Date dimension over which you're computing PeriodToDate aggregations. period The time period across which you're computing the computation. Granularity of YEAR means YearToDate computation, Quarter means QuarterToDate, and so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. endDate (Optional) The date dimension that you're ending computing periodToDate aggregations. It defaults to now() if omitted. Example The following example calculates the week-to-date, 90th percentile of fare amount per payment type for the week of 06-30-21. For simplicity in the example, we filtered out only a single payment. 06-30-21 is Wednesday. QuickSight begins the week on Sundays. In our example, that is 06-27-21. periodToDatePercentileCont(fare_amount, 90, pickupDatetime, WEEK, parseDate("06-30-2021", "MM-dd-yyyy")) Functions and operators 406 Amazon QuickSight User Guide periodToDateStDev The periodToDateStDev function calculates the standard deviation of the set of numbers in the specified measure for a given time granularity (for instance, a quarter) up to a point in time, based on a sample and relative to that period. Syntax periodToDateStDev( measure, dateTime, period, endDate (optional)) Functions and operators 407 Amazon QuickSight Arguments measure User Guide The argument must be a field. Null values are omitted from the results. Literal values don't work. dateTime The Date dimension over which you're computing PeriodToDate aggregations. period (Optional) The time period across which you're computing the computation. Granularity of YEAR means YearToDate computation, Quarter means QuarterToDate, and so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. endDate (Optional) The date dimension that you're ending computing periodToDate aggregations. It defaults to now() if omitted. Example The following example calculates the week-to-date minimum fare amount per payment type, for the
amazon-quicksight-user-120
amazon-quicksight-user.pdf
120
Amazon QuickSight Arguments measure User Guide The argument must be a field. Null values are omitted from the results. Literal values don't work. dateTime The Date dimension over which you're computing PeriodToDate aggregations. period (Optional) The time period across which you're computing the computation. Granularity of YEAR means YearToDate computation, Quarter means QuarterToDate, and so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. endDate (Optional) The date dimension that you're ending computing periodToDate aggregations. It defaults to now() if omitted. Example The following example calculates the week-to-date minimum fare amount per payment type, for the week of 06-30-21. For simplicity in the example, we filtered out only a single payment. 06-30-21 is Wednesday. QuickSight begins the week on Sundays. In our example, that is 06-27-21. periodToDateStDev(fare_amount, pickUpDatetime, WEEK, parseDate("06-30-2021", "MM-dd- yyyy")) Functions and operators 408 Amazon QuickSight User Guide periodToDateStDevP The periodToDateStDevP function calculates the population standard deviation of the set of numbers in the specified measure, for a given time granularity (for instance, a quarter) up to a point in time, based on a sample in that period. Syntax periodToDateStDevP( measure, dateTime, period, endDate (optional)) Functions and operators 409 Amazon QuickSight Arguments measure User Guide The argument must be a field. Null values are omitted from the results. Literal values don't work. dateTime The Date dimension over which you're computing PeriodToDate aggregations. period The time period across which you're computing the computation. Granularity of YEAR means YearToDate computation, Quarter means QuarterToDate, and so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. endDate (Optional) The date dimension that you're ending computing periodToDate aggregations. It defaults to now() if omitted. Example The following example calculates the week-to-date minimum fare amount per payment type, for the week of 06-30-21. For simplicity in the example, we filtered out only a single payment. 06-30-21 is Wednesday. QuickSight begins the week on Sundays. In our example, that is 06-27-21. periodToDateStDevP(fare_amount, pickUpDatetime, WEEK, parseDate("06-30-2021", "MM-dd- yyyy")) Functions and operators 410 Amazon QuickSight User Guide periodToDateSum The periodToDateSum function adds the specified measure for a given time granularity (for instance, a quarter) up to a point in time, relative to that period. Syntax periodToDateSum( measure, dateTime, period, endDate) Functions and operators 411 Amazon QuickSight Arguments measure User Guide The argument must be a field. Null values are omitted from the results. Literal values don't work. dateTime The Date dimension over which you're computing PeriodToDate aggregations. period The time period across which you're computing the computation. Granularity of YEAR means YearToDate computation, Quarter means QuarterToDate, and so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. endDate (Optional) The date dimension that you're ending computing periodToDate aggregations. It defaults to now() if omitted. Example The following function calculates the week to date sum of fare amount per payment, for the week of 06-30-21. For simplicity in the example, we filtered out only a single payment. 06-30-21 is Wednesday. QuickSight begins the week on Sundays. In our example, that is 06-27-21. periodToDateSum(fare_amount, pickUpDateTime, WEEK, parseDate("06-30-2021", "MM-dd- yyyy")) Functions and operators 412 Amazon QuickSight User Guide periodToDateVar The periodToDateVar function calculates the sample variance of the set of numbers in the specified measure for a given time granularity (for instance, a quarter) up to a point in time in that period. Syntax periodToDateVar( measure, dateTime, period, endDate (optional)) Functions and operators 413 Amazon QuickSight Arguments measure User Guide The argument must be a field. Null values are omitted from the results. Literal values don't work. dateTime The Date dimension over which you're computing PeriodToDate aggregations. period The time period across which you're computing the computation. Granularity of YEAR means YearToDate computation, Quarter means QuarterToDate, and so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. endDate (Optional) The date dimension that you're ending computing periodToDate aggregations. It defaults to now() if omitted. Example The following example calculates the week-to-date minimum fare amount per payment type, for the week of 06-30-21. For simplicity in the example, we filtered out only a single payment. 06-30-21 is Wednesday. QuickSight begins the week on Sundays. In our example, that is 06-27-21. periodToDateVar(fare_amount, pickUpDatetime, WEEK, parseDate("06-30-2021", "MM-dd- yyyy")) Functions and operators 414 Amazon QuickSight User Guide periodToDateVarP The periodToDateVarP function calculates the population variance of the set of numbers in the specified measure for a given time granularity (for instance, a quarter) up to a point in time, relevant to that period. Syntax periodToDateVarP( measure, dateTime, period, endDate (optional)) Functions and operators 415 Amazon QuickSight Arguments measure User Guide The argument must be a field. Null values are omitted from the results. Literal values don't work. dateTime The Date dimension over which you're computing PeriodToDate aggregations. period The time period across which you're computing the computation. Granularity
amazon-quicksight-user-121
amazon-quicksight-user.pdf
121
yyyy")) Functions and operators 414 Amazon QuickSight User Guide periodToDateVarP The periodToDateVarP function calculates the population variance of the set of numbers in the specified measure for a given time granularity (for instance, a quarter) up to a point in time, relevant to that period. Syntax periodToDateVarP( measure, dateTime, period, endDate (optional)) Functions and operators 415 Amazon QuickSight Arguments measure User Guide The argument must be a field. Null values are omitted from the results. Literal values don't work. dateTime The Date dimension over which you're computing PeriodToDate aggregations. period The time period across which you're computing the computation. Granularity of YEAR means YearToDate computation, Quarter means QuarterToDate, and so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. endDate (Optional) The date dimension that you're ending computing periodToDate aggregations. It defaults to now() if omitted. Example The following example calculates the week-to-date minimum fare amount per payment type, for the week of 06-30-21. For simplicity in the example, we filtered out only a single payment. 06-30-21 is Wednesday. QuickSight begins the week on Sundays. In our example, that is 06-27-21. periodToDateVarP(fare_amount, pickUpDatetime, WEEK, parseDate("06-30-2021", "MM-dd- yyyy")) Functions and operators 416 Amazon QuickSight User Guide stdev The stdev function calculates the standard deviation of the set of numbers in the specified measure, grouped by the chosen dimension or dimensions, based on a sample. Syntax stdev(measure, [group-by level]) Arguments measure The argument must be a measure. Null values are omitted from the results. Literal values don't work. The argument must be a field. Functions and operators 417 Amazon QuickSight group-by level User Guide (Optional) Specifies the level to group the aggregation by. The level added can be any dimension or dimensions independent of the dimensions added to the visual. The argument must be a dimension field. The group-by level must be enclosed in square brackets [ ]. For more information, see LAC-A functions. Examples The following example returns the standard deviation of test scores for a class, using a sample of the test scores recorded. stdev({Score}) You can also specify at what level to group the computation using one or more dimensions in the view or in your dataset. This is called a LAC-A function. For more information about LAC-A functions, see LAC-A functions. The following example calculates the standard deviation of test scores at the subject level, but not across other dimensions (Class) in the visual. stdev({Score}, [Subject]) stdevp The stdevp function calculates the population standard deviation of the set of numbers in the specified measure, grouped by the chosen dimension or dimensions. Syntax stdevp(measure, [group-by level]) Arguments measure The argument must be a measure. Null values are omitted from the results. Literal values don't work. The argument must be a field. Functions and operators 418 Amazon QuickSight group-by level User Guide (Optional) Specifies the level to group the aggregation by. The level added can be any dimension or dimensions independent of the dimensions added to the visual. The argument must be a dimension field. The group-by level must be enclosed in square brackets [ ]. For more information, see LAC-A functions. Examples The following example returns the standard deviation of test scores for a class using all the scores recorded. stdevp({Score}) You can also specify at what level to group the computation using one or more dimensions in the view or in your dataset. This is called a LAC-A function. For more information about LAC-A functions, see LAC-A functions. The following example calculates the standard deviation of test scores at the subject level, but not across other dimensions (Class) in the visual using all the scores recorded. stdevp({Score}, [Subject]) stdevIf Based on a conditional statement, the stdevIf function calculates the standard deviation of the set of numbers in the specified measure, grouped by the chosen dimension or dimensions, based on a sample. Syntax stdevIf(measure, conditions) Arguments measure The argument must be a measure. Null values are omitted from the results. Literal values don't work. The argument must be a field. Functions and operators 419 Amazon QuickSight condition One or more conditions in a single statement. stdevpIf User Guide Based on a conditional statement, the stdevpIf function calculates the standard deviation of the set of numbers in the specified measure, grouped by the chosen dimension or dimensions, based on a biased population. Syntax stdevpIf(measure, conditions) Arguments measure The argument must be a measure. Null values are omitted from the results. Literal values don't work. The argument must be a field. condition One or more conditions in a single statement. sum The sum function adds the set of numbers in the specified measure, grouped by the chosen dimension or dimensions. For example, sum(profit amount) returns the total profit amount grouped by the (optional) chosen dimension. Syntax sum(measure, [group-by level]) Arguments measure The argument must be a measure.
amazon-quicksight-user-122
amazon-quicksight-user.pdf
122
in the specified measure, grouped by the chosen dimension or dimensions, based on a biased population. Syntax stdevpIf(measure, conditions) Arguments measure The argument must be a measure. Null values are omitted from the results. Literal values don't work. The argument must be a field. condition One or more conditions in a single statement. sum The sum function adds the set of numbers in the specified measure, grouped by the chosen dimension or dimensions. For example, sum(profit amount) returns the total profit amount grouped by the (optional) chosen dimension. Syntax sum(measure, [group-by level]) Arguments measure The argument must be a measure. Null values are omitted from the results. Literal values don't work. The argument must be a field. Functions and operators 420 Amazon QuickSight group-by level User Guide (Optional) Specifies the level to group the aggregation by. The level added can be any dimension or dimensions independent of the dimensions added to the visual. The argument must be a dimension field. The group-by level must be enclosed in square brackets [ ]. For more information, see LAC-A functions. Examples The following example returns the sum of sales. sum({Sales}) You can also specify at what level to group the computation using one or more dimensions in the view or in your dataset. This is called a LAC-A function. For more information about LAC-A functions, see LAC-A functions. The following example calculates the sum of sales at the Country level, but not across other dimensions (Region and Product) in the visual. sum(Sales, [Country]) Functions and operators 421 Amazon QuickSight User Guide sumIf Based on a conditional statement, the sumIf function adds the set of numbers in the specified measure, grouped by the chosen dimension or dimensions. For example, sumIf(ProdRev,CalendarDay >= ${BasePeriodStartDate} AND CalendarDay <= ${BasePeriodEndDate} AND SourcingType <> 'Indirect') returns the total profit amount grouped by the (optional) chosen dimension, if the condition evaluates to true. Syntax sumIf(measure, conditions) Arguments measure The argument must be a measure. Null values are omitted from the results. Literal values don't work. The argument must be a field. Functions and operators 422 Amazon QuickSight condition One or more conditions in a single statement. Examples User Guide The following example uses a calculated field with sumIf to display the sales amount if Segment is equal to SMB. sumIf(Sales, Segment=’SMB’) The following example uses a calculated field with sumIf to display the sales amount if Segment is equal to SMB and Order Date greater than year 2022. sumIf(Sales, Segment=’SMB’ AND {Order Date} >=’2022-01-01’) var The var function calculates the sample variance of the set of numbers in the specified measure, grouped by the chosen dimension or dimensions. Syntax var(measure, [group-by level]) Functions and operators 423 Amazon QuickSight Arguments measure User Guide The argument must be a measure. Null values are omitted from the results. Literal values don't work. The argument must be a field. group-by level (Optional) Specifies the level to group the aggregation by. The level added can be any dimension or dimensions independent of the dimensions added to the visual. The argument must be a dimension field. The group-by level must be enclosed in square brackets [ ]. For more information, see LAC-A functions. Examples The following example returns the variance of a sample of test scores. var({Scores}) You can also specify at what level to group the computation using one or more dimensions in the view or in your dataset. This is called a LAC-A function. For more information about LAC-A functions, see LAC-A functions. The following example returns the variance of a sample of test scores at the subject level, but not across other dimensions (Class) in the visual. var({Scores}, [Subject] varIf Based on a conditional statement, the varIf function calculates the variance of the set of numbers in the specified measure, grouped by the chosen dimension or dimensions, based on a sample. Syntax varIf(measure, conditions) Functions and operators 424 Amazon QuickSight Arguments measure User Guide The argument must be a measure. Null values are omitted from the results. Literal values don't work. The argument must be a field. condition One or more conditions in a single statement. varp The varp function calculates the population variance of the set of numbers in the specified measure, grouped by the chosen dimension or dimensions. Syntax varp(measure, [group-by level]) Arguments measure The argument must be a measure. Null values are omitted from the results. Literal values don't work. The argument must be a field. group-by level (Optional) Specifies the level to group the aggregation by. The level added can be any dimension or dimensions independent of the dimensions added to the visual. The argument must be a dimension field. The group-by level must be enclosed in square brackets [ ]. For more information, see LAC-A functions. Examples The following example returns the variance of a population of test
amazon-quicksight-user-123
amazon-quicksight-user.pdf
123
grouped by the chosen dimension or dimensions. Syntax varp(measure, [group-by level]) Arguments measure The argument must be a measure. Null values are omitted from the results. Literal values don't work. The argument must be a field. group-by level (Optional) Specifies the level to group the aggregation by. The level added can be any dimension or dimensions independent of the dimensions added to the visual. The argument must be a dimension field. The group-by level must be enclosed in square brackets [ ]. For more information, see LAC-A functions. Examples The following example returns the variance of a population of test scores. varp({Scores}) Functions and operators 425 Amazon QuickSight User Guide You can also specify at what level to group the computation using one or more dimensions in the view or in your dataset. This is called a LAC-A function. For more information about LAC-A functions, see LAC-A functions. The following example returns the variance of a population test scores at the subject level, but not across other dimensions (Class) in the visual. varp({Scores}, [Subject] varpIf Based on a conditional statement, the varpIf function calculates the variance of the set of numbers in the specified measure, grouped by the chosen dimension or dimensions, based on a biased population. Syntax varpIf(measure, conditions) Arguments measure The argument must be a measure. Null values are omitted from the results. Literal values don't work. The argument must be a field. condition One or more conditions in a single statement. Table calculation functions When you are analyzing data in a specific visual, you can apply table calculations to the current set of data to discover how dimensions influence measures or each other. Visualized data is your result set based on your current dataset, with all the filters, field selections, and customizations applied. To see exactly what this result set is, you can export your visual to a file. A table calculation function performs operations on the data to reveal relationships between fields. In this section, you can find a list of the functions available in table calculations that you can perform on visualized data in Amazon QuickSight. To view a list of functions sorted by category, with brief definitions, see Functions by category. Functions and operators 426 User Guide Amazon QuickSight Topics • difference • distinctCountOver • lag • lead • percentDifference • avgOver • countOver • maxOver • minOver • percentileOver • percentileContOver • percentileDiscOver • percentOfTotal • periodOverPeriodDifference • periodOverPeriodLastValue • periodOverPeriodPercentDifference • periodToDateAvgOverTime • periodToDateCountOverTime • periodToDateMaxOverTime • periodToDateMinOverTime • periodToDateSumOverTime • stdevOver • stdevpOver • varOver • varpOver • sumOver • denseRank Functions and operators 427 User Guide Amazon QuickSight • rank • percentileRank • runningAvg • runningCount • runningMax • runningMin • runningSum • firstValue • lastValue • windowAvg • windowCount • windowMax • windowMin • windowSum difference The difference function calculates the difference between a measure based on one set of partitions and sorts, and a measure based on another. The difference function is supported for use with analyses based on SPICE and direct query data sets. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. difference ( measure ,[ sortorder_field ASC_or_DESC, ... ] ,lookup_index, ,[ partition field, ... ] ) Functions and operators 428 Amazon QuickSight Arguments measure User Guide An aggregated measure that you want to see the difference for. sort order field One or more measures and dimensions that you want to sort the data by, separated by commas. You can specify either ascending (ASC) or descending (DESC) sort order. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). lookup index The lookup index can be positive or negative, indicating a following row in the sort (positive) or a previous row in the sort (negative). The lookup index can be 1–2,147,483,647. For the engines MySQL, MariaDB and Aurora MySQL-Compatible Edition, the lookup index is limited to just 1. partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). Example The following example calculates the difference between of sum({Billed Amount}), sorted by Customer Region ascending, compared to the next row, and partitioned by Service Line. difference( sum( {Billed Amount} ), [{Customer Region} ASC], 1, [{Service Line}] ) The following example calculates the difference between Billed Amount compared to the next line, partitioned by ([{Customer Region}]). The fields in the table calculation are in the field wells of the visual. Functions and operators 429 Amazon QuickSight User Guide difference( sum( {Billed Amount} ), [{Customer Region} ASC], 1 ) The red
amazon-quicksight-user-124
amazon-quicksight-user.pdf
124
The entire list is enclosed in [ ] (square brackets). Example The following example calculates the difference between of sum({Billed Amount}), sorted by Customer Region ascending, compared to the next row, and partitioned by Service Line. difference( sum( {Billed Amount} ), [{Customer Region} ASC], 1, [{Service Line}] ) The following example calculates the difference between Billed Amount compared to the next line, partitioned by ([{Customer Region}]). The fields in the table calculation are in the field wells of the visual. Functions and operators 429 Amazon QuickSight User Guide difference( sum( {Billed Amount} ), [{Customer Region} ASC], 1 ) The red highlights show how each amount is added ( a + b = c ) to show the difference between amounts a and c. distinctCountOver The distinctCountOver function calculates the distinct count of the operand partitioned by the specified attributes at a specified level. Supported levels are PRE_FILTER and PRE_AGG. The operand must be unaggregated. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. distinctCountOver ( measure or dimension field Functions and operators 430 Amazon QuickSight User Guide ,[ partition_field, ... ] ,calculation level ) Arguments measure or dimension field The measure or dimension that you want to do the calculation for, for example {Sales Amt}. Valid values are PRE_FILTER and PRE_AGG. partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). calculation level (Optional) Specifies the calculation level to use: • PRE_FILTER – Prefilter calculations are computed before the dataset filters. • PRE_AGG – Preaggregate calculations are computed before applying aggregations and top and bottom N filters to the visuals. This value defaults to POST_AGG_FILTER when blank. POST_AGG_FILTER is not a valid level for this operation and will result in an error message. For more information, see Using level- aware calculations in Amazon QuickSight. Example The following example gets the distinct count of Sales partitioned over City and State at the PRE_AGG level. distinctCountOver ( Sales, [City, State], PRE_AGG ) Functions and operators 431 Amazon QuickSight lag User Guide The lag function calculates the lag (previous) value for a measure based on specified partitions and sorts. lag is supported for use with analyses based on SPICE and direct query data sets. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. lag ( lag ( measure ,[ sortorder_field ASC_or_DESC, ... ] ,lookup_index ,[ partition_field, ... ] )] ) Arguments measure The measure that you want to get the lag for. This can include an aggregate, for example sum({Sales Amt}). sort order field One or more measures and dimensions that you want to sort the data by, separated by commas. You can specify either ascending (ASC) or descending (DESC) sort order. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). lookup index The lookup index can be positive or negative, indicating a following row in the sort (positive) or a previous row in the sort (negative). The lookup index can be 1–2,147,483,647. For the engines MySQL, MariaDB, and Amazon Aurora MySQL-Compatible Edition, the lookup index is limited to just 1. Functions and operators 432 Amazon QuickSight partition field User Guide (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). Example The following example calculates the previous sum(sales), partitioned by the state of origin, in the ascending sort order on cancellation_code. lag ( sum(Sales), [cancellation_code ASC], 1, [origin_state_nm] ) The following example uses a calculated field with lag to display sales amount for the previous row next to the amount for the current row, sorted by Order Date. The fields in the table calculation are in the field wells of the visual. lag( sum({Sales}), [{Order Date} ASC], 1 ) The following screenshot shows the results of the example. Functions and operators 433 Amazon QuickSight User Guide The following example uses a calculated field with lag to display the sales amount for the previous row next to the amount for the current row, sorted by Order Date partitioned by Segment. lag ( sum(Sales), [Order Date ASC], 1, [Segment] ) The following screenshot shows the results of the example. Functions and operators 434 Amazon QuickSight User Guide Functions and operators 435 Amazon QuickSight lead User Guide The lead function calculates the lead (following) value for a measure based on specified partitions and sorts. Syntax The brackets are
amazon-quicksight-user-125
amazon-quicksight-user.pdf
125
of the example. Functions and operators 433 Amazon QuickSight User Guide The following example uses a calculated field with lag to display the sales amount for the previous row next to the amount for the current row, sorted by Order Date partitioned by Segment. lag ( sum(Sales), [Order Date ASC], 1, [Segment] ) The following screenshot shows the results of the example. Functions and operators 434 Amazon QuickSight User Guide Functions and operators 435 Amazon QuickSight lead User Guide The lead function calculates the lead (following) value for a measure based on specified partitions and sorts. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. lead ( measure ,[ sortorder_field ASC_or_DESC, ... ] ,lookup_index, ,[ partition_field, ... ] ) Arguments measure The measure that you want to get the lead for. This can include an aggregate, for example sum({Sales Amt}). sort order field One or more measures and dimensions that you want to sort the data by, separated by commas. You can specify either ascending (ASC) or descending (DESC) sort order. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). lookup index The lookup index can be positive or negative, indicating a following row in the sort (positive) or a previous row in the sort (negative). The lookup index can be 1–2,147,483,647. For the engines MySQL, MariaDB, and Amazon Aurora MySQL-Compatible Edition, the lookup index is limited to just 1. partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). Functions and operators 436 Amazon QuickSight Example User Guide The following example calculates the next sum(sales), partitioned by the state of origin, in the ascending sort order on cancellation_code. lead ( sum(sales), [cancellation_code ASC], 1, [origin_state_nm] ) The following example uses a calculated field with lead to display the amount for the next row beside the amount for the current row, sorted by Customer Segment. The fields in the table calculation are in the field wells of the visual. lead( sum({Billed Amount}), [{Customer Segment} ASC], 1 ) The following screenshot shows the results of the example. Functions and operators 437 Amazon QuickSight percentDifference User Guide The percentDifference function calculates the percentage difference between the current value and a comparison value, based on partitions, sorts, and lookup index. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. percentDifference ( measure ,[ sortorder_field ASC_or_DESC, ... ] ,lookup index ,[ partition_field, ... ] ) Arguments measure An aggregated measure that you want to see the percent difference for. sort order field One or more measures and dimensions that you want to sort the data by, separated by commas. You can specify either ascending (ASC) or descending (DESC) sort order. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). lookup index The lookup index can be positive or negative, indicating a following row in the sort (positive) or a previous row in the sort (negative). The lookup index can be 1–2,147,483,647. For the engines MySQL, MariaDB and Aurora MySQL-Compatible Edition, the lookup index is limited to just 1. partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). Functions and operators 438 Amazon QuickSight Example User Guide The following example calculates the percentage of difference between the sum(Sales) for the current and the previous State, sorted by Sales. percentDifference ( sum(amount), [sum(amount) ASC], -1, [State] ) The following example calculates the percent that a specific Billed Amount is of another Billed Amount, sorted by ([{Customer Region} ASC]). The fields in the table calculation are in the field wells of the visual. percentDifference ( sum( {Billed Amount} ), [{Customer Region} ASC], 1 ) The following screenshot shows the results of the example. The red letters show that the total Billed Amount for the Customer Region APAC is 24 percent less than the amount for the EMEA region. Functions and operators 439 Amazon QuickSight User Guide avgOver The avgOver function calculates the average of a measure partitioned by a list of dimensions. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. avgOver ( measure ,[ partition_field, ... ] ,calculation level ) The following example shows the average Billed Amount over Customer Region.
amazon-quicksight-user-126
amazon-quicksight-user.pdf
126
), [{Customer Region} ASC], 1 ) The following screenshot shows the results of the example. The red letters show that the total Billed Amount for the Customer Region APAC is 24 percent less than the amount for the EMEA region. Functions and operators 439 Amazon QuickSight User Guide avgOver The avgOver function calculates the average of a measure partitioned by a list of dimensions. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. avgOver ( measure ,[ partition_field, ... ] ,calculation level ) The following example shows the average Billed Amount over Customer Region. The fields in the table calculation are in the field wells of the visual. avgOver ( sum({Billed Amount}), [{Customer Region}] ) Functions and operators 440 Amazon QuickSight User Guide The following screenshot shows the results of the example. With the addition of Service Line, the total amount billed for each is displayed, and the average of these three values displays in the calculated field. Arguments measure The measure that you want to do the calculation for, for example sum({Sales Amt}). Use an aggregation if the calculation level is set to NULL or POST_AGG_FILTER. Don't use an aggregation if the calculation level is set to PRE_FILTER or PRE_AGG. partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). calculation level (Optional) Specifies the calculation level to use: Functions and operators 441 Amazon QuickSight User Guide • PRE_FILTER – Prefilter calculations are computed before the dataset filters. • PRE_AGG – Preaggregate calculations are computed before applying aggregations and top and bottom N filters to the visuals. • POST_AGG_FILTER – (Default) Table calculations are computed when the visuals display. This value defaults to POST_AGG_FILTER when blank. For more information, see Using level- aware calculations in Amazon QuickSight. Example The following example gets the average sum(Sales) partitioned over City and State. avgOver ( sum(Sales), [City, State] ) countOver The countOver function calculates the count of a dimension or measure partitioned by a list of dimensions. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. countOver ( measure or dimension field ,[ partition_field, ... ] ,calculation level ) Arguments measure or dimension field The measure or dimension that you want to do the calculation for, for example sum({Sales Amt}). Use an aggregation if the calculation level is set to NULL or POST_AGG_FILTER. Don't use an aggregation if the calculation level is set to PRE_FILTER or PRE_AGG. Functions and operators 442 Amazon QuickSight partition field User Guide (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). calculation level (Optional) Specifies the calculation level to use: • PRE_FILTER – Prefilter calculations are computed before the dataset filters. • PRE_AGG – Preaggregate calculations are computed before applying aggregations and top and bottom N filters to the visuals. • POST_AGG_FILTER – (Default) Table calculations are computed when the visuals display. This value defaults to POST_AGG_FILTER when blank. For more information, see Using level- aware calculations in Amazon QuickSight. Example The following example gets the count of Sales partitioned over City and State. countOver ( Sales, [City, State] ) The following example gets the count of {County} partitioned over City and State. countOver ( {County}, [City, State] ) The following example shows the count of Billed Amount over Customer Region. The fields in the table calculation are in the field wells of the visual. countOver Functions and operators 443 Amazon QuickSight ( sum({Billed Amount}), [{Customer Region}] ) User Guide The following screenshot shows the results of the example. Because there are no other fields involved, the count is one for each region. If you add additional fields, the count changes. In the following screenshot, we add Customer Segment and Service Line. Each of those fields contains three unique values. With 3 segments, 3 service lines, and 3 regions, the calculated field shows 9. Functions and operators 444 Amazon QuickSight User Guide If you add the two additional fields to the partitioning fields in the calculated field, countOver( sum({Billed Amount}), [{Customer Region}, {Customer Segment}, {Service Line}], then the count is again 1 for each row. Functions and operators 445 Amazon QuickSight User Guide maxOver The maxOver function calculates the maximum of a measure or date partitioned by a list of dimensions. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. maxOver ( measure ,[ partition_field, ... ] ,calculation level ) Functions and
amazon-quicksight-user-127
amazon-quicksight-user.pdf
127
regions, the calculated field shows 9. Functions and operators 444 Amazon QuickSight User Guide If you add the two additional fields to the partitioning fields in the calculated field, countOver( sum({Billed Amount}), [{Customer Region}, {Customer Segment}, {Service Line}], then the count is again 1 for each row. Functions and operators 445 Amazon QuickSight User Guide maxOver The maxOver function calculates the maximum of a measure or date partitioned by a list of dimensions. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. maxOver ( measure ,[ partition_field, ... ] ,calculation level ) Functions and operators 446 Amazon QuickSight Arguments measure User Guide The measure that you want to do the calculation for, for example sum({Sales Amt}). Use an aggregation if the calculation level is set to NULL or POST_AGG_FILTER. Don't use an aggregation if the calculation level is set to PRE_FILTER or PRE_AGG. partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). calculation level (Optional) Specifies the calculation level to use: • PRE_FILTER – Prefilter calculations are computed before the dataset filters. • PRE_AGG – Preaggregate calculations are computed before applying aggregations and top and bottom N filters to the visuals. • POST_AGG_FILTER – (Default) Table calculations are computed when the visuals display. This value defaults to POST_AGG_FILTER when blank. For more information, see Using level- aware calculations in Amazon QuickSight. Example The following example calculates the maximum sum(Sales), partitioned by City and State. maxOver ( sum(Sales), [City, State] ) The following example shows the maximum Billed Amount over Customer Region. The fields in the table calculation are in the field wells of the visual. maxOver Functions and operators 447 Amazon QuickSight ( sum({Billed Amount}), [{Customer Region}] ) User Guide The following screenshot shows the results of the example. With the addition of Service Line, the total amount billed for each is displayed, and the maximum of these three values displays in the calculated field. minOver The minOver function calculates the minimum of a measure or date partitioned by a list of dimensions. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. minOver ( measure Functions and operators 448 Amazon QuickSight User Guide ,[ partition_field, ... ] ,calculation level ) Arguments measure The measure that you want to do the calculation for, for example sum({Sales Amt}). Use an aggregation if the calculation level is set to NULL or POST_AGG_FILTER. Don't use an aggregation if the calculation level is set to PRE_FILTER or PRE_AGG. partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). calculation level (Optional) Specifies the calculation level to use: • PRE_FILTER – Prefilter calculations are computed before the dataset filters. • PRE_AGG – Preaggregate calculations are computed before applying aggregations and top and bottom N filters to the visuals. • POST_AGG_FILTER – (Default) Table calculations are computed when the visuals display. This value defaults to POST_AGG_FILTER when blank. For more information, see Using level- aware calculations in Amazon QuickSight. Example The following example calculates the min sum(Sales), partitioned by City and State. minOver ( sum(Sales), [City, State] ) Functions and operators 449 Amazon QuickSight User Guide The following example shows the minimum Billed Amount over Customer Region. The fields in the table calculation are in the field wells of the visual. minOver ( sum({Billed Amount}), [{Customer Region}] ) The following screenshot shows the results of the example. With the addition of Service Line, the total amount billed for each is displayed, and the minimum of these three values displays in the calculated field. percentileOver The percentileOver function calculates the nth percentile of a measure partitioned by a list of dimensions. There are two varieties of the percentileOver calculation available in QuickSight: • percentileContOver uses linear interpolation to determine result. • percentileDiscOver uses actual values to determine result. Functions and operators 450 Amazon QuickSight User Guide The percentileOver function is an alias of percentileDiscOver. percentileContOver The percentileContOver function calculates the percentile based on the actual numbers in measure. It uses the grouping and sorting that are applied in the field wells. The result is partitioned by the specified dimension at the specified calculation level. Use this function to answer the following question: Which actual data points are present in this percentile? To return the nearest percentile value that is present in your dataset, use percentileDiscOver. To return an exact percentile value that might not be present in
amazon-quicksight-user-128
amazon-quicksight-user.pdf
128
result. Functions and operators 450 Amazon QuickSight User Guide The percentileOver function is an alias of percentileDiscOver. percentileContOver The percentileContOver function calculates the percentile based on the actual numbers in measure. It uses the grouping and sorting that are applied in the field wells. The result is partitioned by the specified dimension at the specified calculation level. Use this function to answer the following question: Which actual data points are present in this percentile? To return the nearest percentile value that is present in your dataset, use percentileDiscOver. To return an exact percentile value that might not be present in your dataset, use percentileContOver instead. Syntax percentileDiscOver ( measure , percentile-n , [partition-by, …] , calculation-level ) Arguments measure Specifies a numeric value to use to compute the percentile. The argument must be a measure or metric. Nulls are ignored in the calculation. percentile-n The percentile value can be any numeric constant 0–100. A percentile value of 50 computes the median value of the measure. partition-by (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in { } (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). calculation-level Specifies where to perform the calculation in relation to the order of evaluation. There are three supported calculation levels: Functions and operators 451 Amazon QuickSight • PRE_FILTER • PRE_AGG User Guide • POST_AGG_FILTER (default) – To use this calculation level, specify an aggregation on measure, for example sum(measure). PRE_FILTER and PRE_AGG are applied before the aggregation occurs in a visualization. For these two calculation levels, you can't specify an aggregation on measure in the calculated field expression. To learn more about calculation levels and when they apply, see Order of evaluation in Amazon QuickSight and Using level-aware calculations in Amazon QuickSight. Returns The result of the function is a number. Example of percentileContOver The following example helps explain how percentileContOver works. Example Comparing calculation levels for the median The following example shows the median for a dimension (category) by using different calculation levels with the percentileContOver function. The percentile is 50. The dataset is filtered by a region field. The code for each calculated field is as follows: • example = left( category, 1 ) (A simplified example.) • pre_agg = percentileContOver ( {Revenue} , 50 , [ example ] , PRE_AGG) • pre_filter = percentileContOver ( {Revenue} , 50 , [ example ] , PRE_FILTER) • post_agg_filter = percentileContOver ( sum ( {Revenue} ) , 50 , [ example ], POST_AGG_FILTER ) example pre_filter pre_agg post_agg_filter ------------------------------------------------------ 0 106,728 119,667 4,117,579 1 102,898 95,946 2,307,547 2 97,807 93,963 554,570 3 101,043 112,585 2,709,057 4 96,533 99,214 3,598,358 Functions and operators 452 Amazon QuickSight User Guide 5 106,293 97,296 1,875,648 6 97,118 69,159 1,320,672 7 100,201 90,557 969,807 percentileDiscOver The percentileDiscOver function calculates the percentile based on the actual numbers in measure. It uses the grouping and sorting that are applied in the field wells. The result is partitioned by the specified dimension at the specified calculation level. The percentileOver function is an alias of percentileDiscOver. Use this function to answer the following question: Which actual data points are present in this percentile? To return the nearest percentile value that is present in your dataset, use percentileDiscOver. To return an exact percentile value that might not be present in your dataset, use percentileContOver instead. Syntax percentileDiscOver ( measure , percentile-n , [partition-by, …] , calculation-level ) Arguments measure Specifies a numeric value to use to compute the percentile. The argument must be a measure or metric. Nulls are ignored in the calculation. percentile-n The percentile value can be any numeric constant 0–100. A percentile value of 50 computes the median value of the measure. partition-by (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in { } (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). Functions and operators 453 Amazon QuickSight calculation-level User Guide Specifies where to perform the calculation in relation to the order of evaluation. There are three supported calculation levels: • PRE_FILTER • PRE_AGG • POST_AGG_FILTER (default) – To use this calculation level, you need to specify an aggregation on measure, for example sum(measure). PRE_FILTER and PRE_AGG are applied before the aggregation occurs in a visualization. For these two calculation levels, you can't specify an aggregation on measure in the calculated field expression. To learn more about calculation levels and when they apply, see Order of evaluation in Amazon QuickSight and Using level-aware calculations in Amazon QuickSight. Returns The result of the function is a number. Example of percentileDiscOver The following example helps explain
amazon-quicksight-user-129
amazon-quicksight-user.pdf
129
There are three supported calculation levels: • PRE_FILTER • PRE_AGG • POST_AGG_FILTER (default) – To use this calculation level, you need to specify an aggregation on measure, for example sum(measure). PRE_FILTER and PRE_AGG are applied before the aggregation occurs in a visualization. For these two calculation levels, you can't specify an aggregation on measure in the calculated field expression. To learn more about calculation levels and when they apply, see Order of evaluation in Amazon QuickSight and Using level-aware calculations in Amazon QuickSight. Returns The result of the function is a number. Example of percentileDiscOver The following example helps explain how percentileDiscOver works. Example Comparing calculation levels for the median The following example shows the median for a dimension (category) by using different calculation levels with the percentileDiscOver function. The percentile is 50. The dataset is filtered by a region field. The code for each calculated field is as follows: • example = left( category, 1 ) (A simplified example.) • pre_agg = percentileDiscOver ( {Revenue} , 50 , [ example ] , PRE_AGG) • pre_filter = percentileDiscOver ( {Revenue} , 50 , [ example ] , PRE_FILTER) • post_agg_filter = percentileDiscOver ( sum ( {Revenue} ) , 50 , [ example ], POST_AGG_FILTER ) example pre_filter pre_agg post_agg_filter ------------------------------------------------------ Functions and operators 454 Amazon QuickSight User Guide 0 106,728 119,667 4,117,579 1 102,898 95,946 2,307,547 2 97,629 92,046 554,570 3 100,867 112,585 2,709,057 4 96,416 96,649 3,598,358 5 106,293 97,296 1,875,648 6 97,118 64,395 1,320,672 7 99,915 90,557 969,807 Example The median The following example calculates the median (the 50th percentile) of Sales partitioned by City and State. percentileDiscOver ( Sales, 50, [City, State] ) The following example calculates the 98th percentile of sum({Billed Amount}) partitioned by Customer Region. The fields in the table calculation are in the field wells of the visual. percentileDiscOver ( sum({Billed Amount}), 98, [{Customer Region}] ) The following screenshot shows the how these two examples look on a chart. Functions and operators 455 Amazon QuickSight percentOfTotal User Guide The percentOfTotal function calculates the percentage a measure contributes to the total, based on the dimensions specified. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. percentOfTotal ( measure ,[ partition_field, ... ] ) Arguments measure An aggregated measure that you want to see the percent of total for. Currently, the distinct count aggregation is not supported for percentOfTotal. partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). Example The following example creates a calculation for the percent of total Sales contributed by each State. percentOfTotal ( sum(Sales), [State] ) Functions and operators 456 Amazon QuickSight User Guide The following example calculates the percent that a specific Billed Amount is when compared to the total Billed Amount, partitioned by ([{Service Line} ASC]). The fields in the table calculation are in the field wells of the visual. percentOfTotal ( sum( {Billed Amount} ), [{Service Line}] ) The following screenshot shows the results of the example. The red highlights show that the partition field with the value "Billing" has three entries, one for each region. The total billed amount for this service line is divided into three percentages, which total 100 percent. Percentages are rounded and might not always add up to exactly 100 percent. periodOverPeriodDifference The periodOverPeriodDifference function calculates the difference of a measure over two different time periods as specified by period granularity and offset. Unlike a difference calculation, Functions and operators 457 Amazon QuickSight User Guide this function uses a date-based offset instead of a fixed sized offset. This ensures that only the correct dates are compared, even if data points are missing in the dataset. Syntax periodOverPeriodDifference( measure, date, period, offset) Arguments measure An aggregated measure that you want to perform the periodOverPeriod calculation on. dateTime The Date dimension over which we are computing Period-Over-Period calculations. period (Optional) The time period across which you're computing the computation. Granularity of YEAR means YearToDate computation, Quarter means QuarterToDate, and so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. The defaults value is the visual date dimension granularity. offset (Optional) The offset can be a positive or negative integer representing the prior time period (specified by period) that you want to compare against. For instance, period of a quarter with offset 1 means comparing against the previous quarter. The default value is 1. Example The following example uses a calculated field PeriodOverPeriod to display the sales amount difference of yesterday Functions and operators 458 Amazon QuickSight User Guide periodOverPeriodDifference(sum(Sales), {Order Date}) The following example uses a calculated field PeriodOverPeriod to display
amazon-quicksight-user-130
amazon-quicksight-user.pdf
130
QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. The defaults value is the visual date dimension granularity. offset (Optional) The offset can be a positive or negative integer representing the prior time period (specified by period) that you want to compare against. For instance, period of a quarter with offset 1 means comparing against the previous quarter. The default value is 1. Example The following example uses a calculated field PeriodOverPeriod to display the sales amount difference of yesterday Functions and operators 458 Amazon QuickSight User Guide periodOverPeriodDifference(sum(Sales), {Order Date}) The following example uses a calculated field PeriodOverPeriod to display the sales amount difference of previous 2 months. Below example is comparing sales of Mar2020 with Jan2020. periodOverPeriodDifference(sum(Sales),{Order Date}, MONTH, 1) Functions and operators 459 Amazon QuickSight User Guide periodOverPeriodLastValue The periodOverPeriodLastValue function calculates the last (previous) value of a measure from the previous time period as specified by the period granularity and offset. This function uses a date-based offset instead of a fixed sized offset. This ensures only the correct dates are compared, even if data points are missing in the dataset. Syntax periodOverPeriodLastValue( measure, date, period, offset) Functions and operators 460 Amazon QuickSight Arguments measure User Guide An aggregated measure that you want to see the difference for. date The date dimension over which you're computing periodOverPeriod calculations. period (Optional) The time period across which you're computing the computation. Granularity of YEAR means YearToDate computation, Quarter means QuarterToDate, and so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. This argument defaults to the granularity of the visual aggregation offset (Optional) The offset can a positive or negative integer representing the prior time period (specified by period) that you want to compare against. For instance, period of a quarter with offset 1 means comparing against the previous quarter. This argument default value is 1. Example The following example calculates the month over month value in sales with the visual dimension granularity and default offset of 1. periodOverPeriodLastValue(sum(Sales), {Order Date}) The following example calculates the month over month value in sales with a fixed granularity of MONTH and fixed offset of 1. periodOverPeriodLastValue(sum(Sales), {Order Date},MONTH, 1) Functions and operators 461 Amazon QuickSight User Guide periodOverPeriodPercentDifference The periodOverPeriodPercentDifference function calculates the percent difference of a measure over two different time periods as specified by the period granularity and offset. Unlike percentDifference, this function uses a date-based offset instead of a fixed sized offset. This ensures only the correct dates are compared, even if data points are missing in the dataset. Syntax periodOverPeriodPercentDifference( measure, date, period, offset) Functions and operators 462 Amazon QuickSight Arguments measure User Guide An aggregated measure that you want to see the difference for. date The date dimension over which you're computing periodOverPeriod calculations. period (Optional) The time period across which you're computing the computation. Granularity of YEAR means YearToDate computation, Quarter means QuarterToDate, and so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. This argument defaults to the granularity of the visual aggregation offset (Optional) The offset can a positive or negative integer representing the prior time period (specified by period) that you want to compare against. For instance, period of a quarter with offset 1 means comparing against the previous quarter. This argument default value is 1. Example The following example calculates the month over month percent difference in sales with the visual dimension granularity and default offset of 1. periodOverPeriodPercentDifference(sum(Sales),{Order Date}) The following example calculates the month over month percent difference in sales with a fixed granularity of MONTH and fixed offset of 1. periodOverPeriodPercentDifference(sum(Sales), {Order Date}, MONTH, 1) Functions and operators 463 Amazon QuickSight User Guide periodToDateAvgOverTime The periodToDateAvgOverTime function calculates the average of a measure for a given time granularity (for instance, a quarter) up to a point in time. Syntax periodToDateAvgOverTime( measure, dateTime, period) Functions and operators 464 Amazon QuickSight Arguments measure User Guide An aggregated measure that you want to do the calculation dateTime The date dimension over which you're computing PeriodOverTime calculations. period (Optional) The time period across which you're computing the computation. Granularity of YEAR means YearToDate computation, Quarter means QuarterToDate, and so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. The default value is the visual's date dimension granularity. Example The following function calculates the average fare amount month over mont. periodToDateAvgOverTime(sum({fare_amount}), pickupDatetime, MONTH) Functions and operators 465 Amazon QuickSight User Guide periodToDateCountOverTime The periodToDateCountOverTime function calculates the count of a dimension or measure for a given time granularity (for instance, a quarter) up to a point in time. Syntax periodToDateCountOverTime( measure, dateTime, period) Arguments measure An aggregated measure that you want to do the calculation Functions and operators 466 Amazon QuickSight dateTime User Guide The date dimension over which you're computing PeriodOverTime
amazon-quicksight-user-131
amazon-quicksight-user.pdf
131
MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. The default value is the visual's date dimension granularity. Example The following function calculates the average fare amount month over mont. periodToDateAvgOverTime(sum({fare_amount}), pickupDatetime, MONTH) Functions and operators 465 Amazon QuickSight User Guide periodToDateCountOverTime The periodToDateCountOverTime function calculates the count of a dimension or measure for a given time granularity (for instance, a quarter) up to a point in time. Syntax periodToDateCountOverTime( measure, dateTime, period) Arguments measure An aggregated measure that you want to do the calculation Functions and operators 466 Amazon QuickSight dateTime User Guide The date dimension over which you're computing PeriodOverTime calculations. period (Optional) The time period across which you're computing the computation. Granularity of YEAR means YearToDate computation, Quarter means QuarterToDate, and so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. The default value is the visual's date dimension granularity. Example The following example calculates the count of vendors month over month. periodToDateCountOverTime(count(vendorid), pickupDatetime, MONTH) Functions and operators 467 Amazon QuickSight periodToDateMaxOverTime User Guide The periodToDateMaxOverTime function calculates the maximum of a measure for a given time granularity (for instance, a quarter) up to a point in time. Syntax periodToDateMaxOverTime( measure, dateTime, period) Arguments measure An aggregated measure that you want to do the calculation dateTime The date dimension over which you're computing PeriodOverTime calculations. period (Optional) The time period across which you're computing the computation. Granularity of YEAR means YearToDate computation, Quarter means QuarterToDate, and so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. The default value is the visual's date dimension granularity. Example The following example calculates the maximum fare amount month over month. periodToDatemaxOverTime(max({fare_amount}), pickupDatetime, MONTH) Functions and operators 468 Amazon QuickSight User Guide periodToDateMinOverTime The periodToDateMinOverTime function calculates the minimum of a measure for a given time granularity (for instance, a quarter) up to a point in time. Syntax periodToDateMinOverTime( measure, dateTime, period) Arguments measure An aggregated measure that you want to do the calculation Functions and operators 469 Amazon QuickSight dateTime User Guide The date dimension over which you're computing PeriodOverTime calculations. period (Optional) The time period across which you're computing the computation. Granularity of YEAR means YearToDate computation, Quarter means QuarterToDate, and so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. The default value is the visual's date dimension granularity. Example The following example calculates the minimum fare amount month over month. periodToDateMinOverTime(min({fare_amount}), pickupDatetime, MONTH) Functions and operators 470 Amazon QuickSight periodToDateSumOverTime User Guide The periodToDateSumOverTime function calculates the sum of a measure for a given time granularity (for instance, a quarter) up to a point in time. Syntax periodToDateSumOverTime( measure, dateTime, period) Arguments measure An aggregated measure that you want to do the calculation dateTime The date dimension over which you're computing PeriodOverTime calculations. period (Optional) The time period across which you're computing the computation. Granularity of YEAR means YearToDate computation, Quarter means QuarterToDate, and so on. Valid granularities include YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECONDS. The default value is the visual's date dimension granularity. Example The following function returns the total fare amount month over month. periodToDateSumOverTime(sum({fare_amount}), pickupDatetime, MONTH) Functions and operators 471 Amazon QuickSight User Guide stdevOver The stdevOver function calculates the standard deviation of the specified measure, partitioned by the chosen attribute or attributes, based on a sample. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. stdevOver ( measure ,[ partition_field, ... ] ,calculation level ) Functions and operators 472 Amazon QuickSight Arguments measure User Guide The measure that you want to do the calculation for, for example sum({Sales Amt}). Use an aggregation if the calculation level is set to NULL or POST_AGG_FILTER. Don't use an aggregation if the calculation level is set to PRE_FILTER or PRE_AGG. partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). calculation level (Optional) Specifies the calculation level to use: • PRE_FILTER – Prefilter calculations are computed before the dataset filters. • PRE_AGG – Preaggregate calculations are computed before applying aggregations and top and bottom N filters to the visuals. • POST_AGG_FILTER – (default) table calculations are computed when the visuals display. This value defaults to POST_AGG_FILTER when blank. For more information, see Using level- aware calculations in Amazon QuickSight. Example The following example calculates the standard deviation of sum(Sales), partitioned by City and State, based on a sample.. stdevOver ( sum(Sales), [City, State] ) The following example calculates the standard deviation of Billed Amount over Customer Region, based on a sample. The fields in the table calculation are in the field wells of the
amazon-quicksight-user-132
amazon-quicksight-user.pdf
132
calculations are computed before applying aggregations and top and bottom N filters to the visuals. • POST_AGG_FILTER – (default) table calculations are computed when the visuals display. This value defaults to POST_AGG_FILTER when blank. For more information, see Using level- aware calculations in Amazon QuickSight. Example The following example calculates the standard deviation of sum(Sales), partitioned by City and State, based on a sample.. stdevOver ( sum(Sales), [City, State] ) The following example calculates the standard deviation of Billed Amount over Customer Region, based on a sample. The fields in the table calculation are in the field wells of the visual. stdevOver Functions and operators 473 Amazon QuickSight ( sum({Billed Amount}), [{Customer Region}] ) stdevpOver User Guide The stdevpOver function calculates the standard deviation of the specified measure, partitioned by the chosen attribute or attributes, based on a biased population. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. stdevpOver ( measure ,[ partition_field, ... ] ,calculation level ) Arguments measure The measure that you want to do the calculation for, for example sum({Sales Amt}). Use an aggregation if the calculation level is set to NULL or POST_AGG_FILTER. Don't use an aggregation if the calculation level is set to PRE_FILTER or PRE_AGG. partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). calculation level (Optional) Specifies the calculation level to use: • PRE_FILTER – Prefilter calculations are computed before the dataset filters. • PRE_AGG – Preaggregate calculations are computed before applying aggregations and top and bottom N filters to the visuals. Functions and operators 474 Amazon QuickSight User Guide • POST_AGG_FILTER – (default) table calculations are computed when the visuals display. This value defaults to POST_AGG_FILTER when blank. For more information, see Using level- aware calculations in Amazon QuickSight. Example The following example calculates the standard deviation of sum(Sales), partitioned by City and State, based on a biased population. stdevpOver ( sum(Sales), [City, State] ) The following example calculates the standard deviation of Billed Amount over Customer Region, based on a biased population. The fields in the table calculation are in the field wells of the visual. stdevpOver ( sum({Billed Amount}), [{Customer Region}] ) varOver The varOver function calculates the variance of the specified measure, partitioned by the chosen attribute or attributes, based on a sample. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. varOver ( measure ,[ partition_field, ... ] ,calculation level Functions and operators 475 Amazon QuickSight ) Arguments measure User Guide The measure that you want to do the calculation for, for example sum({Sales Amt}). Use an aggregation if the calculation level is set to NULL or POST_AGG_FILTER. Don't use an aggregation if the calculation level is set to PRE_FILTER or PRE_AGG. partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). calculation level (Optional) Specifies the calculation level to use: • PRE_FILTER – Prefilter calculations are computed before the dataset filters. • PRE_AGG – Preaggregate calculations are computed before applying aggregations and top and bottom N filters to the visuals. • POST_AGG_FILTER – (Default) Table calculations are computed when the visuals display. This value defaults to POST_AGG_FILTER when blank. For more information, see Using level- aware calculations in Amazon QuickSight. Example The following example calculates the variance of sum(Sales), partitioned by City and State, based on a sample. varOver ( sum(Sales), [City, State] ) The following example calculates the variance of Billed Amount over Customer Region, based on a sample. The fields in the table calculation are in the field wells of the visual. Functions and operators 476 Amazon QuickSight varOver ( sum({Billed Amount}), [{Customer Region}] ) varpOver User Guide The varpOver function calculates the variance of the specified measure, partitioned by the chosen attribute or attributes, based on a biased population. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. varpOver ( measure ,[ partition_field, ... ] ,calculation level ) Arguments measure The measure that you want to do the calculation for, for example sum({Sales Amt}). Use an aggregation if the calculation level is set to NULL or POST_AGG_FILTER. Don't use an aggregation if the calculation level is set to PRE_FILTER or PRE_AGG. partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The
amazon-quicksight-user-133
amazon-quicksight-user.pdf
133
are required. To see which arguments are optional, see the following descriptions. varpOver ( measure ,[ partition_field, ... ] ,calculation level ) Arguments measure The measure that you want to do the calculation for, for example sum({Sales Amt}). Use an aggregation if the calculation level is set to NULL or POST_AGG_FILTER. Don't use an aggregation if the calculation level is set to PRE_FILTER or PRE_AGG. partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). calculation level (Optional) Specifies the calculation level to use: • PRE_FILTER – Prefilter calculations are computed before the dataset filters. Functions and operators 477 Amazon QuickSight User Guide • PRE_AGG – Preaggregate calculations are computed before applying aggregations and top and bottom N filters to the visuals. • POST_AGG_FILTER – (Default) Table calculations are computed when the visuals display. This value defaults to POST_AGG_FILTER when blank. For more information, see Using level- aware calculations in Amazon QuickSight. Example The following example calculates the variance of sum(Sales), partitioned by City and State, based on a biased population. varpOver ( sum(Sales), [City, State] ) The following example calculates the variance of Billed Amount over Customer Region, based on a biased population. The fields in the table calculation are in the field wells of the visual. varpOver ( sum({Billed Amount}), [{Customer Region}] ) sumOver The sumOver function calculates the sum of a measure partitioned by a list of dimensions. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. sumOver ( measure ,[ partition_field, ... ] ,calculation level ) Functions and operators 478 Amazon QuickSight Arguments measure User Guide The measure that you want to do the calculation for, for example sum({Sales Amt}). Use an aggregation if the calculation level is set to NULL or POST_AGG_FILTER. Don't use an aggregation if the calculation level is set to PRE_FILTER or PRE_AGG. partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). calculation level (Optional) Specifies the calculation level to use: • PRE_FILTER – Prefilter calculations are computed before the dataset filters. • PRE_AGG – Preaggregate calculations are computed before applying aggregations and top and bottom N filters to the visuals. • POST_AGG_FILTER – (default) table calculations are computed when the visuals display. This value defaults to POST_AGG_FILTER when blank. For more information, see Using level- aware calculations in Amazon QuickSight. Example The following example calculates the sum of sum(Sales), partitioned by City and State. sumOver ( sum(Sales), [City, State] ) The following example sums Billed Amount over Customer Region. The fields in the table calculation are in the field wells of the visual. sumOver Functions and operators 479 Amazon QuickSight ( sum({Billed Amount}), [{Customer Region}] ) User Guide The following screenshot shows the results of the example. With the addition of Customer Segment, the total amount billed for each is summed for the Customer Region, and displays in the calculated field. denseRank The denseRank function calculates the rank of a measure or a dimension in comparison to the specified partitions. It counts each item only once, ignoring duplicates, and assigns a rank "without holes" so that duplicate values share the same rank. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. denseRank ( [ sort_order_field ASC_or_DESC, ... ] Functions and operators 480 Amazon QuickSight ,[ partition_field, ... ] ) Arguments sort order field User Guide One or more aggregated fields, either measures or dimensions or both, that you want to sort the data by, separated by commas. You can either specify ascending (ASC) or descending (DESC) sort order. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). calculation level (Optional) Specifies the calculation level to use: • PRE_FILTER – Prefilter calculations are computed before the dataset filters. • PRE_AGG – Preaggregate calculations are computed before applying aggregations and top and bottom N filters to the visuals. • POST_AGG_FILTER – (Default) Table calculations are computed when the visuals display. This value defaults to POST_AGG_FILTER when blank. For more information, see Using level- aware calculations in Amazon QuickSight. Example
amazon-quicksight-user-134
amazon-quicksight-user.pdf
134
by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). calculation level (Optional) Specifies the calculation level to use: • PRE_FILTER – Prefilter calculations are computed before the dataset filters. • PRE_AGG – Preaggregate calculations are computed before applying aggregations and top and bottom N filters to the visuals. • POST_AGG_FILTER – (Default) Table calculations are computed when the visuals display. This value defaults to POST_AGG_FILTER when blank. For more information, see Using level- aware calculations in Amazon QuickSight. Example The following example densely ranks max(Sales), based on a descending sort order, by State and City. Any cities with the same max(Sales) are assigned the same rank, and the next city is ranked consecutively after them. For example, if three cities share the same ranking, the fourth city is ranked as second. denseRank Functions and operators 481 Amazon QuickSight ( [max(Sales) DESC], [State, City] ) User Guide The following example densely ranks max(Sales), based on a descending sort order, by State. Any states with the same max(Sales) are assigned the same rank, and the next is ranked consecutively after them. For example, if three states share the same ranking, the fourth state is ranked as second. denseRank ( [max(Sales) DESC], [State] ) rank The rank function calculates the rank of a measure or a dimension in comparison to the specified partitions. It counts each item, even duplicates, once and assigns a rank "with holes" to make up for duplicate values. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. rank ( [ sort_order_field ASC_or_DESC, ... ] ,[ partition_field, ... ] ) Arguments sort order field One or more aggregated measures and dimensions that you want to sort the data by, separated by commas. You can specify either ascending (ASC) or descending (DESC) sort order. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). Functions and operators 482 Amazon QuickSight partition field User Guide (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). calculation level (Optional) Specifies the calculation level to use: • PRE_FILTER – Prefilter calculations are computed before the dataset filters. • PRE_AGG – Preaggregate calculations are computed before applying aggregations and top and bottom N filters to the visuals. • POST_AGG_FILTER – (Default) Table calculations are computed when the visuals display. This value defaults to POST_AGG_FILTER when blank. For more information, see Using level- aware calculations in Amazon QuickSight. Example The following example ranks max(Sales), based on a descending sort order, by State and City, within the State of WA. Any cities with the same max(Sales) are assigned the same rank, but the next rank includes the count of all previously existing ranks. For example, if three cities share the same ranking, the fourth city is ranked as fourth. rank ( [max(Sales) DESC], [State, City] ) The following example ranks max(Sales), based on an ascending sort order, by State. Any states with the same max(Sales) are assigned the same rank, but the next rank includes the count of all previously existing ranks. For example, if three states share the same ranking, the fourth state is ranked as fourth. rank ( [max(Sales) ASC], [State] Functions and operators 483 Amazon QuickSight ) User Guide The following example ranks Customer Region by total Billed Amount. The fields in the table calculation are in the field wells of the visual. rank( [sum({Billed Amount}) DESC] ) The following screenshot shows the results of the example, along with the total Billed Amount so you can see how each region ranks. percentileRank The percentileRank function calculates the percentile rank of a measure or a dimension in comparison to the specified partitions. The percentile rank value(x) indicates that the current item is above x% of values in the specified partition. The percentile rank value ranges from 0 (inclusive) to 100 (exclusive). Syntax The brackets are required. To see which arguments are optional, see the following descriptions. percentileRank Functions and operators 484 Amazon QuickSight ( [ sort_order_field ASC_or_DESC, ... ] ,[ {partition_field}, ... ] ) Arguments sort order field User Guide One or more aggregated measures and dimensions that you want to sort the data by, separated by commas. You can specify either ascending (ASC) or descending (DESC) sort order. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). partition
amazon-quicksight-user-135
amazon-quicksight-user.pdf
135
to 100 (exclusive). Syntax The brackets are required. To see which arguments are optional, see the following descriptions. percentileRank Functions and operators 484 Amazon QuickSight ( [ sort_order_field ASC_or_DESC, ... ] ,[ {partition_field}, ... ] ) Arguments sort order field User Guide One or more aggregated measures and dimensions that you want to sort the data by, separated by commas. You can specify either ascending (ASC) or descending (DESC) sort order. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). calculation level (Optional) Specifies the calculation level to use: • PRE_FILTER – Prefilter calculations are computed before the dataset filters. • PRE_AGG – Preaggregate calculations are computed before applying aggregations and top and bottom N filters to the visuals. • POST_AGG_FILTER – (Default) Table calculations are computed when the visuals display. This value defaults to POST_AGG_FILTER when blank. For more information, see Using level- aware calculations in Amazon QuickSight. Example The following example does a percentile ranking of max(Sales) in descending order, by State. percentileRank ( [max(Sales) DESC], [State] ) Functions and operators 485 Amazon QuickSight User Guide The following example does a percentile ranking of Customer Region by total Billed Amount. The fields in the table calculation are in the field wells of the visual. percentileRank( [sum({Billed Amount}) DESC], [{Customer Region}] ) The following screenshot shows the results of the example, along with the total Billed Amount so you can see how each region compares. runningAvg The runningAvg function calculates a running average for a measure based on the specified dimensions and sort orders. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. runningAvg ( measure ,[ sortorder_field ASC_or_DESC, ... ] ,[ partition_field, ... ] Functions and operators 486 Amazon QuickSight ) Arguments measure User Guide An aggregated measure that you want to see the running average for. sort order field One or more measures and dimensions that you want to sort the data by, separated by commas. You can specify either ascending (ASC) or descending (DESC) sort order. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). Example The following example calculates a running average of sum(Sales), sorted by Sales, partitioned by City and State. runningAvg ( sum(Sales), [Sales ASC], [City, State] ) The following example calculates a running average of Billed Amount, sorted by month ([truncDate("MM",Date) ASC]). The fields in the table calculation are in the field wells of the visual. runningAvg ( sum({Billed Amount}), [truncDate("MM",Date) ASC] Functions and operators 487 Amazon QuickSight ) runningCount User Guide The runningCount function calculates a running count for a measure or dimension, based on the specified dimensions and sort orders. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. runningCount ( measure_or_dimension ,[ sortorder_field ASC_or_DESC, ... ] ,[ partition_field, ... ] ) Arguments measure or dimension An aggregated measure or dimension that you want to see the running count for. sort order field One or more measures and dimensions that you want to sort the data by, separated by commas. You can specify either ascending (ASC) or descending (DESC) sort order. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). Example The following example calculates a running count of sum(Sales), sorted by Sales, partitioned by City and State. Functions and operators 488 Amazon QuickSight runningCount ( sum(Sales), [Sales ASC], [City, State] ) User Guide The following example calculates a running count of Billed Amount, sorted by month ([truncDate("MM",Date) ASC]). The fields in the table calculation are in the field wells of the visual. runningCount ( sum({Billed Amount}), [truncDate("MM",Date) ASC] ) runningMax The runningMax function calculates a running maximum for a measure based on the specified dimensions and sort orders.
amazon-quicksight-user-136
amazon-quicksight-user.pdf
136
word. The entire list is enclosed in [ ] (square brackets). Example The following example calculates a running count of sum(Sales), sorted by Sales, partitioned by City and State. Functions and operators 488 Amazon QuickSight runningCount ( sum(Sales), [Sales ASC], [City, State] ) User Guide The following example calculates a running count of Billed Amount, sorted by month ([truncDate("MM",Date) ASC]). The fields in the table calculation are in the field wells of the visual. runningCount ( sum({Billed Amount}), [truncDate("MM",Date) ASC] ) runningMax The runningMax function calculates a running maximum for a measure based on the specified dimensions and sort orders. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. runningMax ( measure ,[ sortorder_field ASC_or_DESC, ... ] ,[ partition_field, ... ] ) Arguments measure An aggregated measure that you want to see the running maximum for. Functions and operators 489 Amazon QuickSight sort order field User Guide One or more measures and dimensions that you want to sort the data by, separated by commas. You can specify either ascending (ASC) or descending (DESC) sort order. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). Example The following example calculates a running maximum of sum(Sales), sorted by Sales, partitioned by City and State. runningMax ( sum(Sales), [Sales ASC], [City, State] ) The following example calculates a running maximum of Billed Amount, sorted by month ([truncDate("MM",Date) ASC]). The fields in the table calculation are in the field wells of the visual. runningMax ( sum({Billed Amount}), [truncDate("MM",Date) ASC] ) runningMin The runningMin function calculates a running minimum for a measure based on the specified dimensions and sort orders. Functions and operators 490 Amazon QuickSight Syntax User Guide The brackets are required. To see which arguments are optional, see the following descriptions. runningMin ( measure ,[ sortorder_field ASC_or_DESC, ... ] ,[ partition_field, ... ] ) Arguments measure An aggregated measure that you want to see the running minimum for. sort order field One or more measures and dimensions that you want to sort the data by, separated by commas. You can specify either ascending (ASC) or descending (DESC) sort order. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). Example The following example calculates a running minimum of sum(Sales), sorted by Sales, partitioned by City and State. runningMin ( sum(Sales), [Sales ASC], [City, State] Functions and operators 491 Amazon QuickSight ) User Guide The following example calculates a running minimum of Billed Amount, sorted by month ([truncDate("MM",Date) ASC]). The fields in the table calculation are in the field wells of the visual. runningMin ( sum({Billed Amount}), [truncDate("MM",Date) ASC] ) runningSum The runningSum function calculates a running sum for a measure based on the specified dimensions and sort orders. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. runningSum ( measure ,[ sortorder_field ASC_or_DESC, ... ] ,[ partition_field, ... ] ) Arguments measure An aggregated measure that you want to see the running sum for. sort order field One or more measures and dimensions that you want to sort the data by, separated by commas. You can specify either ascending (ASC) or descending (DESC) sort order. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). Functions and operators 492 Amazon QuickSight partition field User Guide (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). Example The following example calculates a running sum of sum(Sales), sorted by Sales, partitioned by City and State. runningSum ( sum(Sales), [Sales ASC], [City, State] ) The following example calculates a running sum of Billed Amount, sorted by month ([truncDate("MM",Date) ASC]). The fields in the table calculation are in the field wells of the visual. runningSum ( sum({Billed Amount}), [truncDate("MM",Date) ASC] ) The following screenshot shows the results of the example.
amazon-quicksight-user-137
amazon-quicksight-user.pdf
137
commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). Example The following example calculates a running sum of sum(Sales), sorted by Sales, partitioned by City and State. runningSum ( sum(Sales), [Sales ASC], [City, State] ) The following example calculates a running sum of Billed Amount, sorted by month ([truncDate("MM",Date) ASC]). The fields in the table calculation are in the field wells of the visual. runningSum ( sum({Billed Amount}), [truncDate("MM",Date) ASC] ) The following screenshot shows the results of the example. The red labels show how each amount is added ( a + b = c ) to the next amount, resulting in a new total. Functions and operators 493 Amazon QuickSight User Guide firstValue The firstValue function calculates the first value of the aggregated measure or dimension partitioned and sorted by specified attributes. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. firstValue ( aggregated measure or dimension, [ sort_attribute ASC_or_DESC, ... ], [ partition_by_attribute, ... ] ) Arguments aggregated measure or dimension An aggregated measure or dimension that you want to see the first value for. sort attribute One or more aggregated fields, either measures or dimensions or both, that you want to sort the data by, separated by commas. You can either specify ascending (ASC) or descending (DESC) sort order. Functions and operators 494 Amazon QuickSight User Guide Each field in the list is enclosed in {} (curly braces), if it's more than one word. The entire list is enclosed in [ ] (square brackets). partition by attribute (Optional) One or more measure or dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). Example The following example calculates the first Destination Airport, sorted by Flight Date, partitioned by Flight Date ascending and Origin Airport. firstValue( {Destination Airport} [{Flight Date} ASC], [ {Origin Airport}, {Flight Date} ] ) lastValue The lastValue function calculates the last value of the aggregated measure or dimension partitioned and sorted by specified attributes. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. lastValue ( aggregated measure or dimension, [ sort_attribute ASC_or_DESC, ... ], [ partition_by_attribute, ... ] ) Functions and operators 495 Amazon QuickSight Arguments aggregated measure or dimension User Guide An aggregated measure or dimension that you want to see the last value for. sort attribute One or more aggregated fields, either measures or dimensions or both, that you want to sort the data by, separated by commas. You can either specify ascending (ASC) or descending (DESC) sort order. Each field in the list is enclosed in {} (curly braces), if it's more than one word. The entire list is enclosed in [ ] (square brackets). partition by attribute (Optional) One or more measures or dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). Example The following example calculates the last value for Destination Airport. This calculation is sorted by the Flight Date value and partitioned by the Flight Date value sorted in ascending order and the Origin Airport value. lastValue( [{Destination Airport}], [{Flight Date} ASC], [ {Origin Airport}, truncDate('DAY', {Flight Date}) ] ) windowAvg The windowAvg function calculates the average of the aggregated measure in a custom window that is partitioned and sorted by specified attributes. Usually, you use custom window functions Functions and operators 496 Amazon QuickSight User Guide on a time series, where your visual shows a metric and a date field. For example, you can use windowAvg to calculate a moving average, which is often used to smooth out the noise in a line chart. Window functions aren't supported for MySQL versions earlier than 8 and MariaDB versions earlier than 10.2. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. windowAvg ( measure , [sort_order_field ASC/DESC, ...] , start_index , end_index ,[ partition_field, ... ] ) Arguments measure The aggregated metric that you want to get the average for, for example sum({Revenue}). sort attribute One or more aggregated fields, either measures or dimensions or both, that you want to sort the data by, separated by commas. You can either specify ascending (ASC) or descending (DESC) sort order. Each field in the list is enclosed in { } (curly braces), if it's more than one word. The entire list is enclosed in [ ] (square brackets). start index The start index is a positive
amazon-quicksight-user-138
amazon-quicksight-user.pdf
138
, [sort_order_field ASC/DESC, ...] , start_index , end_index ,[ partition_field, ... ] ) Arguments measure The aggregated metric that you want to get the average for, for example sum({Revenue}). sort attribute One or more aggregated fields, either measures or dimensions or both, that you want to sort the data by, separated by commas. You can either specify ascending (ASC) or descending (DESC) sort order. Each field in the list is enclosed in { } (curly braces), if it's more than one word. The entire list is enclosed in [ ] (square brackets). start index The start index is a positive integer, indicating n rows above the current row. The start index counts the available data points above the current row, rather than counting actual time periods. If your data is sparse (missing months or years, for example), adjust the indexes accordingly. Functions and operators 497 Amazon QuickSight end index User Guide The end index is a positive integer, indicating n rows below the current row. The end index counts the available data points below the current row, rather than counting actual time periods. If your data is sparse (missing months or years, for example), adjust the indexes accordingly. partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it's more than one word. The entire list is enclosed in [ ] (square brackets). Example The following example calculates the moving average of sum(Revenue), partitioned by SaleDate. The calculation includes three rows above and two row below of the current row. windowAvg ( sum(Revenue), [SaleDate ASC], 3, 2 ) The following screenshot shows the results of this moving average example. The sum(Revenue) field is added to the chart to show the difference between the revenue and the moving average of revenue. Functions and operators 498 Amazon QuickSight User Guide windowCount The windowCount function calculates the count of the aggregated measure or dimension in a custom window that is partitioned and sorted by specified attributes. Usually, you use custom window functions on a time series, where your visual shows a metric and a date field. Window functions aren't supported for MySQL versions earlier than 8 and MariaDB versions earlier than 10.2. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. windowCount ( measure_or_dimension , [sort_order_field ASC/DESC, ...] , start_index , end_index ,[ partition_field, ... ] Functions and operators 499 Amazon QuickSight ) Arguments measure or dimension User Guide The aggregated metric that you want to get the average for, for example sum({Revenue}). sort attribute One or more aggregated fields, either measures or dimensions or both, that you want to sort the data by, separated by commas. You can either specify ascending (ASC) or descending (DESC) sort order. Each field in the list is enclosed in {} (curly braces), if it's more than one word. The entire list is enclosed in [ ] (square brackets). start index The start index is a positive integer, indicating n rows above the current row. The start index counts the available data points above the current row, rather than counting actual time periods. If your data is sparse (missing months or years, for example), adjust the indexes accordingly. end index The end index is a positive integer, indicating n rows below the current row. The end index counts the available data points below the current row, rather than counting actual time periods. If your data is sparse (missing months or years, for example), adjust the indexes accordingly. partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it's more than one word. The entire list is enclosed in [ ] (square brackets). Example The following example calculates the moving count of sum(Revenue), partitioned by SaleDate. The calculation includes three rows above and two row below of the current row. Functions and operators 500 Amazon QuickSight windowCount ( sum(Revenue), [SaleDate ASC], 3, 2 ) windowMax User Guide The windowMax function calculates the maximum of the aggregated measure in a custom window that is partitioned and sorted by specified attributes. Usually, you use custom window functions on a time series, where your visual shows a metric and a date field. You can use windowMax to help you identify the maximum of the metric over a period time. Window functions aren't supported for MySQL versions earlier than 8 and MariaDB versions earlier than 10.2. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. windowMax ( measure , [sort_order_field ASC/DESC, ...] , start_index , end_index ,[ partition_field, ... ] ) Arguments measure The aggregated metric that you want to get the average for,
amazon-quicksight-user-139
amazon-quicksight-user.pdf
139
by specified attributes. Usually, you use custom window functions on a time series, where your visual shows a metric and a date field. You can use windowMax to help you identify the maximum of the metric over a period time. Window functions aren't supported for MySQL versions earlier than 8 and MariaDB versions earlier than 10.2. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. windowMax ( measure , [sort_order_field ASC/DESC, ...] , start_index , end_index ,[ partition_field, ... ] ) Arguments measure The aggregated metric that you want to get the average for, for example sum({Revenue}). sort attribute One or more aggregated fields, either measures or dimensions or both, that you want to sort the data by, separated by commas. You can either specify ascending (ASC) or descending (DESC) sort order. Functions and operators 501 Amazon QuickSight User Guide Each field in the list is enclosed in {} (curly braces), if it's more than one word. The entire list is enclosed in [ ] (square brackets). start index The start index is a positive integer, indicating n rows above the current row. The start index counts the available data points above the current row, rather than counting actual time periods. If your data is sparse (missing months or years, for example), adjust the indexes accordingly. end index The end index is a positive integer, indicating n rows below the current row. The end index counts the available data points below the current row, rather than counting actual time periods. If your data is sparse (missing months or years, for example), adjust the indexes accordingly. partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets). Example The following example calculates the trailing 12-month maximum of sum(Revenue), partitioned by SaleDate. The calculation includes 12 rows above and 0 row below of the current row. windowMax ( sum(Revenue), [SaleDate ASC], 12, 0 ) The following screenshot shows the results of this trailing 12-month example. The sum(Revenue) field is added to the chart to show the difference between the revenue and the trailing 12-month maximum revenue. Functions and operators 502 Amazon QuickSight User Guide windowMin The windowMin function calculates the minimum of the aggregated measure in a custom window that is partitioned and sorted by specified attributes. Usually, you use custom window functions on a time series, where your visual shows a metric and a date field. You can use windowMin to help you identify the minimum of the metric over a period time. Window functions aren't supported for MySQL versions earlier than 8 and MariaDB versions earlier than 10.2. Syntax The brackets are required. To see which arguments are optional, see the following descriptions. windowMin ( measure , [sort_order_field ASC/DESC, ...] , start_index , end_index ,[ partition_field, ... ] Functions and operators 503 Amazon QuickSight ) Arguments measure User Guide The aggregated metric that you want to get the average for, for example sum({Revenue}). sort attribute One or more aggregated fields, either measures or dimensions or both, that you want to sort the data by, separated by commas. You can either specify ascending (ASC) or descending (DESC) sort order. Each field in the list is enclosed in {} (curly braces), if it's more than one word. The entire list is enclosed in [ ] (square brackets). start index The start index is a positive integer, indicating n rows above the current row. The start index counts the available data points above the current row, rather than counting actual time periods. If your data is sparse (missing months or years, for example), adjust the indexes accordingly. end index The end index is a positive integer, indicating n rows below the current row. The end index counts the available data points below the current row, rather than counting actual time periods. If your data is sparse (missing months or years, for example), adjust the indexes accordingly. partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it's more than one word. The entire list is enclosed in [ ] (square brackets). Example The following example calculates the trailing 12-month minimum of sum(Revenue), partitioned by SaleDate. The calculation includes 12 rows above and 0 row below of the current row. Functions and operators 504 Amazon QuickSight windowMin ( sum(Revenue), [SaleDate ASC], 12, 0 ) User Guide The following screenshot shows the results of this trailing 12-month example. The sum(Revenue) field is added to the chart to show the difference between the revenue and the trailing 12-month minimum
amazon-quicksight-user-140
amazon-quicksight-user.pdf
140
in the list is enclosed in {} (curly braces), if it's more than one word. The entire list is enclosed in [ ] (square brackets). Example The following example calculates the trailing 12-month minimum of sum(Revenue), partitioned by SaleDate. The calculation includes 12 rows above and 0 row below of the current row. Functions and operators 504 Amazon QuickSight windowMin ( sum(Revenue), [SaleDate ASC], 12, 0 ) User Guide The following screenshot shows the results of this trailing 12-month example. The sum(Revenue) field is added to the chart to show the difference between the revenue and the trailing 12-month minimum revenue. windowSum The windowSum function calculates the sum of the aggregated measure in a custom window that is partitioned and sorted by specified attributes. Usually, you use custom window functions on a time series, where your visual shows a metric and a date field. Window functions aren't supported for MySQL versions earlier than 8 and MariaDB versions earlier than 10.2. Functions and operators 505 Amazon QuickSight Syntax User Guide The brackets are required. To see which arguments are optional, see the following descriptions. windowSum ( measure , [sort_order_field ASC/DESC, ...] , start_index , end_index ,[ partition_field, ... ] ) Arguments measure The aggregated metric that you want to get the sum for, for example sum({Revenue}). For the engines MySQL, MariaDB, and Amazon Aurora with MySQL compatibility, the lookup index is limited to just 1. Window functions aren't supported for MySQL versions below 8 and MariaDB versions earlier than 10.2. sort attribute One or more aggregated fields, either measures or dimensions or both, that you want to sort the data by, separated by commas. You can either specify ascending (ASC) or descending (DESC) sort order. Each field in the list is enclosed in {} (curly braces), if it's more than one word. The entire list is enclosed in [ ] (square brackets). start index The start index is a positive integer, indicating n rows above the current row. The start index counts the available data points above the current row, rather than counting actual time periods. If your data is sparse (missing months or years, for example), adjust the indexes accordingly. end index The end index is a positive integer, indicating n rows below the current row. The end index counts the available data points below the current row, rather than counting actual time Functions and operators 506 Amazon QuickSight User Guide periods. If your data is sparse (missing months or years, for example), adjust the indexes accordingly. partition field (Optional) One or more dimensions that you want to partition by, separated by commas. Each field in the list is enclosed in {} (curly braces), if it's more than one word. The entire list is enclosed in [ ] (square brackets). Example The following example calculates the moving sum of sum(Revenue), sorted by SaleDate. The calculation includes two rows above and one row ahead of the current row. windowSum ( sum(Revenue), [SaleDate ASC], 2, 1 ) The following example show a trailing 12-month sum. windowSum(sum(Revenue),[SaleDate ASC],12,0) The following screenshot shows the results of this trailing 12-month sum example. The sum(Revenue) field is added to the chart to show the difference between the revenue and the trailing 12-month sum of revenue. Functions and operators 507 Amazon QuickSight User Guide Previewing tables in a dataset You can preview each individual data table within a dataset. When you choose a data table to preview, a read-only preview of the table appears in a new tab in the data preview section. You can have multiple table preview tabs open at once. You can only preview tables that you have access to in a dataset. If a table doesn't appear in the top half of the data preparation space, you can't preview the table. The Dataset tab contains all transformations, like new columns or filters. Table preview tabs don't show any of your transforms. To preview a data table 1. On the Amazon QuickSight start page, choose Datasets. 2. Choose the dataset that you want, and choose Edit dataset. 3. Choose the data table that you want to preview, choose the down arrow to open the menu, and choose Show table preview. Previewing tables in a dataset 508 Amazon QuickSight User Guide Joining data You can use the join interface in Amazon QuickSight to join objects from one or more data sources. By using Amazon QuickSight to join the data, you can merge disparate data without duplicating the data from different sources. Types of joined datasets A join is performed between two QuickSight logical tables, where each logical table contains information about how to fetch data. When editing a dataset in QuickSight, the join diagram at the top half of the page shows each logical table as a rectangular block. There are two different types of
amazon-quicksight-user-141
amazon-quicksight-user.pdf
141
dataset 508 Amazon QuickSight User Guide Joining data You can use the join interface in Amazon QuickSight to join objects from one or more data sources. By using Amazon QuickSight to join the data, you can merge disparate data without duplicating the data from different sources. Types of joined datasets A join is performed between two QuickSight logical tables, where each logical table contains information about how to fetch data. When editing a dataset in QuickSight, the join diagram at the top half of the page shows each logical table as a rectangular block. There are two different types of joined datasets in QuickSight: same-source and cross-source. A dataset is considered same-source when it doesn't have any joins, or when all of the following conditions are met: • If any of the logical tables refer to a QuickSight data source: • All of the logical tables in this dataset must refer to the same QuickSight data source. This doesn't apply if two separate QuickSight data sources refer to the same underlying database. Joining data 509 Amazon QuickSight User Guide It must be the exact same QuickSight data source. For more information about using a single data source, see Creating a dataset using an existing data source. • If any of the logical tables refer to a QuickSight dataset that is a parent dataset: • The parent dataset must use direct query. • The parent dataset must refer to the same QuickSight data source. If the above conditions aren't met, the dataset is considered a cross-source join. Facts about joining datasets Both same-source and cross-source dataset joins have the following limitations. What's the maximum number of tables a joined dataset can contain? All joined datasets can contain up to 32 tables. How large can joined data be? The maximum allowed size of a join is determined by the query mode and query engine that is used. The list below provides information about the different size limits for the tables to be joined. The size limit applies to all secondary tables combined. There are no join size limits for the primary table. • Same-source tables – When tables originate from a single query data source, QuickSight imposes no restrictions on the join size. This does not override join size limitations that the source query engine may have in place. • Cross-source datasets – This type of join contains tables from different data sources that aren't stored in SPICE. For these types of joins, QuickSight automatically identifies the largest table in the dataset. The combined size of all other secondary tables must be less than 1 GB. • Datasets stored in SPICE – This type of join contains tables that are all ingested into SPICE. The combined size of all secondary tables in this join cannot exceed 20 GB. For more information about SPICE dataset size calculations, see Estimating the size of SPICE datasets. Facts about joining datasets 510 Amazon QuickSight User Guide Can a joined dataset use direct query? Same-source datasets support direct query, assuming there are no other restrictions on using direct query. For example, S3 data sources don't support direct query, so a same-source S3 dataset must still use SPICE. Cross-source datasets must use SPICE. Can calculated fields be used in a join? All joined datasets can use calculated fields, but calculated fields can't be used in any on-clauses. Can geographical data be used in a join? Same-source datasets support geographical data types, but geographical fields can't be used in any on-clauses. Cross-source datasets don't support geographical data in any form. For some examples of joining tables across data sources, see the Joining across data sources on Amazon QuickSight post on the AWS Big Data Blog. Creating a join Use the following procedure to join tables to use in a dataset. Before you begin, import or connect to your data. You can create a join between any of the data sources supported by Amazon QuickSight, except Internet of Things (IoT) data. For example, you can add comma-separated value (.csv) files, tables, views, SQL queries, or JSON objects in an Amazon S3 bucket. To add one or more joins 1. Open the dataset that you want to work with. 2. (Optional) Before you get started, decide if you want to disable the autogenerated preview based on of a sample of your data. To turn that off, choose Auto-preview at top right. It's turned on by default. 3. If you haven't already chosen a query mode, choose Query mode. Choose SPICE to store your dataset in SPICE, or choose Direct query to pull live data every time. If your dataset contains one ore more manually uploaded file, your dataset is automatically stored in SPICE. Creating a join 511 Amazon QuickSight User Guide If you choose SPICE, the data is ingested into QuickSight.
amazon-quicksight-user-142
amazon-quicksight-user.pdf
142
Before you get started, decide if you want to disable the autogenerated preview based on of a sample of your data. To turn that off, choose Auto-preview at top right. It's turned on by default. 3. If you haven't already chosen a query mode, choose Query mode. Choose SPICE to store your dataset in SPICE, or choose Direct query to pull live data every time. If your dataset contains one ore more manually uploaded file, your dataset is automatically stored in SPICE. Creating a join 511 Amazon QuickSight User Guide If you choose SPICE, the data is ingested into QuickSight. Visuals that use the dataset run queries in SPICE, instead of on the database. If you choose Direct query, the data isn't ingested into SPICE. Visuals that use the dataset run queries on the database, instead of in SPICE. If you choose Query mode, make sure to set unique keys in the join, if applicable, to improve performance when loading visuals. 4. On the data preparation page, choose Add data. 5. In the Add data page that opens, choose one of the following options and complete the steps following: • Add data from a dataset: 1. Choose Dataset. 2. Select a dataset from the list. 3. Choose Select. • Add data from a data source: 1. Choose Data source. 2. Select a data source from the list. 3. Choose Select. 4. Select a table from the list. 5. Choose Select. • Create self-joins by adding a table multiple times. A counter appears after the name. An example is Product, Product (2), and Product (3). Field names in the Fields or Filters sections include the same counter so you can know which instance of the table a field came from. 6. 7. • Add a new file by choosing Upload a file, and then choose the file that you want to join. (Optional) Choose Use custom SQL to open the query editor and write a query for a SQL data source. (Optional) After you add data, interact with each table by choosing its menu icon. Rearrange the tables by dragging and dropping them. Creating a join 512 Amazon QuickSight User Guide An icon with red dots appears to indicate that you need to configure this join. Two red dots appear for joins that aren't yet configured. To create joins, choose the first join configuration icon. 8. (Optional) To change an existing join, reopen Join configuration by choosing the join icon between two tables. The Join Configuration pane opens. On the join interface, specify the join type and the fields to use to join the tables. 9. At the bottom of the screen, you can see options to set a field in one table equal to a field in another table. • In the Join clauses section, choose the join column for each table. Creating a join 513 Amazon QuickSight User Guide (Optional) If the tables that you selected join on multiple columns, choose Add a new join clause. Doing this adds another row to the join clauses, so you can specify the next set of columns to join. Repeat this process until you have identified all of the join columns for the two data objects. 10. In the Join configuration pane, choose the kind of join to apply. If the join fields are a unique key for one or both tables, enable the unique key setting. Unique keys only apply to direct queries, not to SPICE data. For more information about joins, see Join types. Creating a join 514 Amazon QuickSight User Guide 11. Choose Apply to confirm your choices. To cancel without making changes, choose Cancel. 12. The join icon in the workspace changes to show the new relationship. 13. (Optional) In the Fields section, you can use each field's menu to do one or more of the following: • Add a hierarchy to a geospatial field. • Include or Exclude the field. • Edit name & description of the field. • Change data type. • Add a calculation (a calculated field). Creating a join 515 Amazon QuickSight User Guide • Restrict access to only me, so only you can see it. This can be helpful when you are adding fields to a dataset that's already in use. 14. (Optional) In the Filters section, you can add or edit filters. For more information, see Filtering data in Amazon QuickSight. Join types Amazon QuickSight supports the following join types: • Inner joins • Left and right outer joins • Full outer joins Let's take a closer look at what these join types do with your data. For our example data, we're using the following tables named widget and safety rating. SELECT * FROM safety-rating rating_id safety_rating 1 A+ 2 A 3 A- 4 B+ 5 B SELECT * FROM WIDGET widget_id
amazon-quicksight-user-143
amazon-quicksight-user.pdf
143
fields to a dataset that's already in use. 14. (Optional) In the Filters section, you can add or edit filters. For more information, see Filtering data in Amazon QuickSight. Join types Amazon QuickSight supports the following join types: • Inner joins • Left and right outer joins • Full outer joins Let's take a closer look at what these join types do with your data. For our example data, we're using the following tables named widget and safety rating. SELECT * FROM safety-rating rating_id safety_rating 1 A+ 2 A 3 A- 4 B+ 5 B SELECT * FROM WIDGET widget_id widget safety_rating_id 1 WidgetA 3 2 WidgetB 1 3 WidgetC 1 4 WidgetD 2 5 WidgetE 6 WidgetF 5 7 WidgetG Join types 516 Amazon QuickSight Inner joins Use an inner join ( User Guide when you want to see only the data where there is a match between two tables. For example, suppose that you perform an inner join on the safety-rating and widget tables. In the following result set, widgets without safety ratings are removed, and safety ratings without associated widgets are removed. Only the rows that match perfectly are included. SELECT * FROM safety-rating INNER JOIN widget ON safety_rating.rating_id = widget.safety_rating_id rating_id safety_rating widget_id widget safety_rating_id 3 A- 1 WidgetA 3 1 A+ 2 WidgetB 1 1 A+ 3 WidgetC 1 2 A 4 WidgetD 2 5 B 6 WidgetF 5 Left and right outer joins These are also known as left or right outer joins. Use a left ( or right ( outer join when you want to see all the data from one table, and only the matching rows from the other table. In a graphical interface, you can see which table is on the right or the left. In a SQL statement, the first table is considered to be on the left. Therefore, choosing a left outer join as opposed to a right outer join depends only on how the tables are laid out in your query tool. For example, suppose that you perform a left outer join ( on safety-rating (the left table) and widgets (the right table). In this case, all safety- rating rows are returned, and only matching widget rows are returned. You can see blanks in the result set where there is no matching data. Join types 517 ) ) ) ) Amazon QuickSight User Guide SELECT * FROM safety-rating LEFT OUTER JOIN widget ON safety_rating.rating_id = widget.safety_rating_id rating_id safety_rating widget_id widget safety_rating_id 1 A+ 2 WidgetB 1 1 A+ 3 WidgetC 1 2 A 4 WidgetD 2 3 A- 1 WidgetA 3 4 B+ 5 B 6 WidgetF 5 If you instead use a right outer join ( call the tables in the same order so safety-rating is on the left and widgets is on the right. In this case, only matching safety-rating rows are returned, and all widget rows are returned. You can see blanks in the result set where there is no matching data. SELECT * FROM safety-rating RIGHT OUTER JOIN widget ON safety_rating.rating_id = widget.safety_rating_id rating_id safety_rating widget_id widget safety_rating_id 3 A- 1 WidgetA 3 1 A+ 2 WidgetB 1 1 A+ 3 WidgetC 1 2 A 4 WidgetD 2 5 WidgetE 5 B 6 WidgetF 5 7 WidgetG Full outer joins These are sometimes called just outer joins, but this term can refer to either a left outer, right outer, or full outer join. To define the meaning, we use the complete name: full outer join. Use a full outer join ( to see data that matches, plus data from both tables that doesn't match. This type of join includes all rows from both tables. For example, if you perform a full outer join on the safety-rating and Join types 518 ), ) Amazon QuickSight User Guide widget tables, all rows are returned. The rows are aligned where they matched, and all extra data is included on separate rows. You can see blanks in the result set where there is no matching data. SELECT * FROM safety-rating FULL OUTER JOIN widget ON safety_rating.rating_id = widget.safety_rating_id rating_id safety_rating widget_id widget safety_rating_id 1 A+ 2 WidgetB 1 1 A+ 3 WidgetC 1 2 A 4 WidgetD 2 3 A- 1 WidgetA 3 4 B+ 5 B 6 WidgetF 5 5 WidgetE 7 WidgetG Filtering data in Amazon QuickSight You can use filters to refine the data in a dataset or an analysis. For example, you can create a filter on a region field that excludes data from a particular region in a dataset. You can also add a filter to an analysis, such as a filter on the range of dates that you want to include in any visuals in your analysis. When you create a filter in a dataset, that filter applies to the entire dataset.
amazon-quicksight-user-144
amazon-quicksight-user.pdf
144
3 A- 1 WidgetA 3 4 B+ 5 B 6 WidgetF 5 5 WidgetE 7 WidgetG Filtering data in Amazon QuickSight You can use filters to refine the data in a dataset or an analysis. For example, you can create a filter on a region field that excludes data from a particular region in a dataset. You can also add a filter to an analysis, such as a filter on the range of dates that you want to include in any visuals in your analysis. When you create a filter in a dataset, that filter applies to the entire dataset. Any analyses and subsequent dashboards created from that dataset contains the filter. If someone creates a dataset from your dataset, the filter also is in the new dataset. When you create a filter in an analysis, that filter only applies to that analysis and any dashboards you publish from it. If someone duplicates your analysis, the filter persists in the new analysis. In analyses, you can scope filters to a single visual, some visuals, all visuals that use this dataset, or all applicable visuals. Also, when you create filters in an analysis, you can add a filter control to your dashboard. For more information about filter controls, see Adding filter controls to analysis sheets. Each filter you create applies only to a single field. You can apply filters to both regular and calculated fields. There are several types of filters you can add to datasets and analyses. For more information about the types of filters you can add, and some of their options, see Filter types in Amazon QuickSight. Filtering data 519 Amazon QuickSight User Guide If you create multiple filters, all top-level filters apply together using AND. If you group filters by adding them inside a top-level filter, the filters in the group apply using OR. Amazon QuickSight applies all of the enabled filters to the field. For example, suppose that there is one filter of state = WA and another filter of sales >= 500. Then the dataset or analysis only contains records that meet both of those criteria. If you disable one of these, only one filter applies. Take care that multiple filters applied to the same field aren't mutually exclusive. Use the following sections to learn how to view, add, edit, and delete filters. Topics • Viewing existing filters • Adding filters • Cross-sheet filters and controls • Filter types in Amazon QuickSight • Adding filter controls to analysis sheets • Editing filters • Enabling or disabling filters • Deleting filters Viewing existing filters When you edit a dataset or open an analysis, you can view any existing filters that were created. Use the following procedures to learn how. Viewing filters in datasets 1. Open the QuickSight console. 2. From the QuickSight start page, choose Datasets. 3. Choose the dataset that you want, and then choose Edit dataset. 4. On the data preparation page that opens, choose Filters at lower left to expand the Filters section. Any filters that are applied to the dataset appear here. If a single field has multiple filters, they are grouped together. They display in order of create date, with the oldest filter on top. Viewing existing filters 520 Amazon QuickSight User Guide Viewing filters in analyses Use the following procedure to view filters in analyses. To view a filter in an analysis 1. From the QuickSight start page, choose Analyses. 2. On the Analyses page, choose the analysis that you want to work with. 3. In the analysis, choose the Filter icon shown below to open the Filters pane. Viewing existing filters 521 Amazon QuickSight User Guide Any filters applied to the analysis appear here. The way that a filter is scoped is listed at the bottom of each filter. For more information about scoping filters, see Adding filters. Adding filters You can add filters to a dataset or an analysis. Use the following procedures to learn how. Adding filters to datasets Use the following procedure to add filters to datasets. To add a filter to a dataset 1. Open the QuickSight console. 2. From the QuickSight start page, choose Datasets. 3. Choose the dataset that you want, and then choose Edit dataset. 4. On the data preparation page that opens, choose Add filter at lower left, and then choose a field that you want to filter. Adding filters 522 Amazon QuickSight User Guide The filter is added to the Filters pane. 5. Choose the new filter in the pane to configure the filter. Or you can choose the three dots to the right of the new filter and choose Edit. Depending on the data type of the field, your options for configuring the filter vary. For more information about the types of filters that you can create and their
amazon-quicksight-user-145
amazon-quicksight-user.pdf
145
choose Edit dataset. 4. On the data preparation page that opens, choose Add filter at lower left, and then choose a field that you want to filter. Adding filters 522 Amazon QuickSight User Guide The filter is added to the Filters pane. 5. Choose the new filter in the pane to configure the filter. Or you can choose the three dots to the right of the new filter and choose Edit. Depending on the data type of the field, your options for configuring the filter vary. For more information about the types of filters that you can create and their configurations, see Filter types in Amazon QuickSight. 6. When finished, choose Apply. Adding filters 523 Amazon QuickSight Note User Guide The data preview shows you the results of your combined filters only as they apply to the first 1,000 rows. If all of the first 1,000 rows are filtered out, then no rows show in the preview. This effect occurs even when rows after the first 1,000 aren't filtered out. Adding filters in analyses Use the following procedure to add filters to analyses. To add a filter to an analysis 1. Open the QuickSight console. 2. From the QuickSight start page, choose Analyses. 3. On the Analyses page, choose the analysis that you want to work with. 4. In the analysis, choose the Filter icon shown below to open the Filters pane, and then choose ADD. 5. Choose the new filter in the pane to configure it. Or you can choose the three dots to the right of the new filter and choose Edit. 6. In the Edit filter pane that opens, for Applied to, choose one of the following options. • Single visual – The filter applies to the selected item only. • Single sheet – The filter applies to a single sheet. • Cross sheet – The filter applies to multiple sheets in the dataset. Depending on the data type of the field, your remaining options for configuring the filter vary. For more information about the types of filters you can create and their configurations, see Filter types in Amazon QuickSight. Adding filters 524 Amazon QuickSight User Guide Cross-sheet filters and controls Cross-sheet filters and controls are filters that are scoped to either your entire analysis or dashboard or multiple sheets within your analysis and dashboard. Filters Creating a Cross-Sheet Filter 1. Once you have Added a filter, you update the scope of the filter to cross-sheet. By default, this applies to all of the the sheets in your analysis. 2. If the Apply cross-datasets box is checked, then the filter will be applied to all visuals from up to 100 different datasets that are applicable to all sheets in the filter scope. 3. If you want to customize the sheets that it is applied to, then choose the Cross-sheet icon. You can then view the sheets the filter is currently applied to or toggle on the custom select sheets. Cross-sheet filters and controls 525 Amazon QuickSight User Guide 4. When you enable Custom select sheets, you can select which sheets to apply the filter to: 5. Follow the steps at Editing filters in analyses. Your changes will be applied to all of the filters for all of the sheets you have selected. This includes newly added sheets if the filter is scoped to your entire analysis. Cross-sheet filters and controls 526 Amazon QuickSight Removing a Cross-Sheet Filter Deleting User Guide If you have no controls created from these filters, see Deleting filters in analyses. If you have controls created then: 1. Follow the instructions at Deleting filters in analyses. 2. You will see the following modal when you choose Delete: 3. If you choose Delete Filter and Controls, the controls will be deleted from all pages. This may impact the layout of your analysis. Alternatively, you can remove these controls individually. Downscoping If you want to remove a cross-sheet filter, you can also do this by changing the filter scope: 1. Follow the instructions at Editing filters in analysesto get to the filter. 2. One of the edits you can make is changing the scope. You can switch to Single sheet or Single visual. You can also remove a sheet from the Cross-sheet selection Or the custom sheet selection: Cross-sheet filters and controls 527 Amazon QuickSight User Guide 3. If there are controls, you will get the following modal to warn you that you will be bulk- removing controls from any of the sheets where the filter no longer applies and this can impact your layout. You can also remove the controls individually. For more information, see Removing a Cross-Sheet Control. Cross-sheet filters and controls 528 Amazon QuickSight User Guide 4. If you add controls to the Top of all sheets in filter scope then new sheets
amazon-quicksight-user-146
amazon-quicksight-user.pdf
146
remove a sheet from the Cross-sheet selection Or the custom sheet selection: Cross-sheet filters and controls 527 Amazon QuickSight User Guide 3. If there are controls, you will get the following modal to warn you that you will be bulk- removing controls from any of the sheets where the filter no longer applies and this can impact your layout. You can also remove the controls individually. For more information, see Removing a Cross-Sheet Control. Cross-sheet filters and controls 528 Amazon QuickSight User Guide 4. If you add controls to the Top of all sheets in filter scope then new sheets will by default be added with this new control if the filter is scoped to your entire analysis. Controls Creating a Cross-Sheet Control New filter control 1. Create a cross-sheet filter. For more information, see Filters. 2. From the three-dot menu, you can see an option that says Add control. Hovering over this, you will see three options: • Top of all sheets in filter scope • Top of this sheet • Inside this sheet If you want to add to multiple-sheets within the sheets themselves, you can do that sheet-by- sheet. Or you can add to the top and then use the option on each control to Move to sheet. For more information, see Editing a Cross-Sheet Control. Increasing Scope of Existing Control 1. Navigate to the existing filter in the analysis 2. Change the scope of what sheets this filter is Applied to to Cross-sheet. Cross-sheet filters and controls 529 Amazon QuickSight User Guide 3. If there is already a control created from the filter, you will get the following modal, which if you check the box will bulk-add controls to the top of all the sheets in the filter scope. This will not impact the position of the already created control if it is on the sheet: Editing a Cross-Sheet Control 1. Go to the cross-sheet control and select the three-dot menu if the control is pinned to the top or the edit pencil icon if the control is on the sheet. You will be presented with the following options: • Go to filter (which directs you to the cross-sheet filter for you to edit or review • Move to sheet (which moves the control into the analysis pane) • Reset • Refresh • Edit • Remove Cross-sheet filters and controls 530 Amazon QuickSight On sheet User Guide Top of sheet 2. Choose Edit. This brings up the Format Control pane on the right side of your analysis. Cross-sheet filters and controls 531 Amazon QuickSight User Guide Cross-sheet filters and controls 532 Amazon QuickSight User Guide 3. You can then edit your control. The top section labeled Cross-sheet settings will apply to all controls, whereas any settings outside of this section are not applicable to all controls and only to the specific control you’re editing. For instance, Relevant value is not a cross-sheet control setting. 4. You can also see the sheets that this control is on as well as the location (Top or Sheet) that the control is on for each sheet. You can do this by chossing Sheets(8) (as shown following: Cross-sheet filters and controls 533 Amazon QuickSight User Guide Cross-sheet filters and controls 534 Amazon QuickSight Removing a Cross-Sheet Control User Guide You can remove controls in two places. First, from the control: 1. Go to the cross-sheet control and select the three-dot menu if the control is pinned to the top or the edit pencil icon if the control is on the sheet. You will be presented with the following options: • Go to filter (which directs you to the cross-sheet filter for you to edit or review • Move to sheet (which moves the control into the analysis pane) • Reset • Refresh • Edit • Remove 2. Choose Remove Second, you can remove controls from the filter: 1. Choose the three-dot menu on the cross-sheet filter that the cross-sheet controls are created from. You will see that instead of an option to Add control there is now an option to Manage control. 2. Hover over Manage control. You will be presented with the following options: • Move inside this sheet • Top of this sheet These options are applicable to just the control on the sheet, depending on where the current control is. If you don’t have controls on all of the sheets within the filter scope, you will get the option to Add to top of all sheets in filter scope. This will not move sheet controls to the top of the sheet if you have already added them to the sheet in the analysis. You will also get the option to Remove from this sheet or Remove from all sheets. Cross-sheet filters and controls 535 Amazon QuickSight User Guide
amazon-quicksight-user-147
amazon-quicksight-user.pdf
147
Top of this sheet These options are applicable to just the control on the sheet, depending on where the current control is. If you don’t have controls on all of the sheets within the filter scope, you will get the option to Add to top of all sheets in filter scope. This will not move sheet controls to the top of the sheet if you have already added them to the sheet in the analysis. You will also get the option to Remove from this sheet or Remove from all sheets. Cross-sheet filters and controls 535 Amazon QuickSight User Guide Filter types in Amazon QuickSight You can create several different types of filters in Amazon QuickSight. The type of filter you create mostly depends on the data type of the field that you want to filter. In datasets, you can create the following types of filters: • Text filters • Numeric filters • Date filters In analyses, you can create the same types of filters as you can in datasets. You can also create: • Group filters with and/or operators • Cascading filters • Nested filters Use the following sections to learn more about each type of filter you can create and some of their options. Topics • Adding text filters Filter types 536 Amazon QuickSight • Adding nested filters • Adding numeric filters • Adding date filters • Adding filter conditions (group filters) with AND and OR operators • Creating cascading filters Adding text filters User Guide When you add a filter using a text field, you can create the following types of text filters: • Filter list (Analyses only) – This option creates a filter that you can use to select one or more field values to include or exclude from all the available values in the field. For more information about creating this type of text filter, see Filtering text field values by a list (analyses only). • Custom filter list – With this option, you can enter one or more field values to filter on, and whether you want to include or exclude records that contain those values. The values that you enter must match the actual field values exactly for the filter to be applied to a given record. For more information about creating this type of text filter, see Filtering text field values by a custom list. • Custom filter – With this option, you enter a single value that the field value must match in some way. You can specify that the field value must equal, not equal, starts with, ends with, contains, or does not contain the value you specify. If you choose an equal comparison, the specified value and actual field value must match exactly in order for the filter to be applied to a given record. For more information about creating this type of text filter, see Filtering a single text field value. • Top and bottom filter (Analyses only) – You can use this option to show the top or bottom n value of one field ranked by the values in another field. For example, you might show the top five salespeople based on revenue. You can also use a parameter to allow dashboard users to dynamically choose how many top or bottom ranking values to show. For more information about creating top and bottom filters, see Filtering a text field by a top or bottom value (analyses only). Filtering text field values by a list (analyses only) In analyses, you can filter a text field by selecting values to include or exclude from a list of all value in the field. Filter types 537 Amazon QuickSight User Guide To filter a text field by including and excluding values 1. Create a new filter using a text field. For more information about creating filters, see Adding filters. 2. 3. 4. In the Filters pane, choose the new filter to expand it. For Filter type, choose Filter list. For Filter condition, choose Include or Exclude. 5. Choose the field values that you want to filter on. To do this, select the check box in front of each value. If there are too many values to choose from, enter a search term into the box above the checklist and choose Search. Search terms are case-insensitive and wildcards aren't supported. Any field value that contains the search term is returned. For example, searching on L returns al, AL, la, and LA. The values display alphabetically in the control, unless there are more than 1,000 distinct values. Then the control displays a search box instead. Each time that you search for the value that you want to use, it starts a new query. If the results contain more than 1,000 values, you can scroll through the values with pagination. 6. When finished, choose
amazon-quicksight-user-148
amazon-quicksight-user.pdf
148
term into the box above the checklist and choose Search. Search terms are case-insensitive and wildcards aren't supported. Any field value that contains the search term is returned. For example, searching on L returns al, AL, la, and LA. The values display alphabetically in the control, unless there are more than 1,000 distinct values. Then the control displays a search box instead. Each time that you search for the value that you want to use, it starts a new query. If the results contain more than 1,000 values, you can scroll through the values with pagination. 6. When finished, choose Apply. Filtering text field values by a custom list You can specify one or more field values to filter on, and whether you want to include or exclude records that contain those values. The specified value and actual field value must match exactly for the filter to be applied to a given record. To filter text field values by a custom list 1. Create a new filter using a text field. For more information about creating filters, see Adding filters. In the Filters pane, choose the new filter to expand it. For Filter type, choose Custom filter list. For Filter condition, choose Include or Exclude. For List, enter a value in the text box. The value must match an existing field value exactly. (Optional) To add additional values, enter them in the text box, one per line. 2. 3. 4. 5. 6. Filter types 538 Amazon QuickSight User Guide 7. For Null options choose Exclude nulls, Include nulls, or Nulls only. 8. When finished, choose Apply. Filtering a single text field value With the Custom filter filter type, you specify a single value that the field value must equal or not equal, or must match partially. If you choose an equal comparison, the specified value and actual field value must match exactly for the filter to be applied to a given record. To filter a text field by a single value 1. Create a new filter using a text field. For more information about creating filters, see Adding filters. 2. 3. 4. In the Filters pane, choose the new filter to expand it. For Filter type, choose Custom filter. For Filter condition, choose one of the following: • Equals – When you choose this option, the values included or excluded in the field must match the value that you enter exactly. • Does not equal – When you choose this option, the values included or excluded in the field must match the value that you enter exactly. • Starts with – When you choose this option, the values included or excluded in the field must start with the value that you enter. • Ends with – When you choose this option, the values included or excluded in the field must start with the value that you enter. • Contains – When you choose this option, the values included or excluded in the field must contain the whole value that you enter. • Does not contain – When you choose this option, the values included or excluded in the field must not contain any part of the value that you enter. Note Comparison types are case-sensitive. 5. Do one of the following: Filter types 539 Amazon QuickSight User Guide • For Value, enter a literal value. • Select Use parameters to use an existing parameter, and then choose a parameter from the list. For parameters to appear in this list, create your parameters first. Usually, you create a parameter, add a control for it, and then add a filter for it. For more information, see Parameters in Amazon QuickSight. The values display alphabetically in the control, unless there are more than 1,000 distinct values. Then the control displays a search box instead. Each time that you search for the value that you want to use, it starts a new query. If the results contain more than 1,000 values, you can scroll through the values with pagination. 6. For Null options choose Exclude nulls, Include nulls, or Nulls only. 7. When finished, choose Apply. Filtering a text field by a top or bottom value (analyses only) You can use a Top and bottom filter to show the top or bottom n value of one field ranked by the values in another field. For example, you might show the top five salespeople based on revenue. You can also use a parameter to allow dashboard users to dynamically choose how many top or bottom ranking values to show. To create a top and bottom text filter 1. Create a new filter using a text field. For more information about creating filters, see Adding filters. 2. 3. In the Filters pane, choose the new filter to expand it. For Filter type, choose Top and bottom
amazon-quicksight-user-149
amazon-quicksight-user.pdf
149
bottom filter to show the top or bottom n value of one field ranked by the values in another field. For example, you might show the top five salespeople based on revenue. You can also use a parameter to allow dashboard users to dynamically choose how many top or bottom ranking values to show. To create a top and bottom text filter 1. Create a new filter using a text field. For more information about creating filters, see Adding filters. 2. 3. In the Filters pane, choose the new filter to expand it. For Filter type, choose Top and bottom filter. 4. Choose Top or Bottom. 5. For Show top integer (or Show bottom integer), do one of the following: • Enter the number of top or bottom items to show. • To use a parameter for the number of top or bottom items to show, select Use parameters. Then choose an existing integer parameter. Filter types 540 Amazon QuickSight User Guide For example, let's say that you want to show the top three salespersons by default. However, you want the dashboard viewer to be able to choose whether to show 1–10 top salespersons. In this case, take the following actions: • Create an integer parameter with a default value. • To link the number of displayed items to a parameter control, create a control for the integer parameter. Then you make the control a slider with a step size of 1, a minimum value of 1, and a maximum value of 10. • To make the control work, link it to a filter by creating a top and bottom filter on Salesperson by Weighted Revenue, enable Use parameters, and choose your integer parameter. 6. 7. For By, choose a field to base the ranking on. If you want to show the top five salespeople per revenue, choose the revenue field. You can also set the aggregate that you want to perform on the field. (Optional) Choose Tie breaker and then choose another field to add one or more aggregations as tie breakers. This is useful, in the case of this example, when there are more than five results returned for the top five salespeople per revenue. This situation can happen if multiple salespeople have the same revenue amount. To remove a tie breaker, use the delete icon. 8. When finished, choose Apply. Adding nested filters Nested filters are advanced filters that can be added to a QuickSight analysis. A Nested filter filters a field using a subset of data defined by another field in that same dataset. This allows authors to show additional contextual data without the need to filter data out if the data point doesn't meet an initial condition. Nested filters function similarly to a correlated subquery in SQL or a market basket analysis. For example, say you want to perform a market basket analysis on your sales data. You can use nested filters to find the sales quantity by product for customers who have or have not purchased a specific product. You can also use nested filters to identify groups of customers that did not purchase a selected product or who only purchased a specific list of products. Nested filters can only be added at the analysis level. You can't add a nested filter to a dataset. Filter types 541 Amazon QuickSight User Guide Use the procedure below to add a nested filter to a QuickSight analysis. 1. Open the QuickSight console. 2. Choose Analyses, and then choose the analysis that you want to add a nested filter to. 3. Create a new filter on the text field that you want to filter on. For more information about creating a filter, see Adding filters in analyses. 4. After you create the new filter, locate the new filter in the Filters pane. Choose the ellipsis (three dots) next to the new filter, and then choose Edit filter. Alternatively, choose the filter entity in the Filters pane to open the Edit filter pane. 5. 6. 7. 8. The Edit filter pane opens. Open the Filter type dropdown menu, navigate to the Avanced filter section, and then choose Nested filter. For Qualifying condition, choose Include or Exclude. The qualifying condition allows you to run a not in the set query on the data in your analysis. In our sales example above, the qualifying condition determines if the filter returns a list of customers who did buy the specifc product or a list of customers who did not buy the product. For Nested field, choose the text field that you want to filter data with. The nested field cannot be the same as the primary field selected in step 3. Category fields are the only supported field type for the inner filter. For Nested filter type, choose the filter type
amazon-quicksight-user-150
amazon-quicksight-user.pdf
150
condition allows you to run a not in the set query on the data in your analysis. In our sales example above, the qualifying condition determines if the filter returns a list of customers who did buy the specifc product or a list of customers who did not buy the product. For Nested field, choose the text field that you want to filter data with. The nested field cannot be the same as the primary field selected in step 3. Category fields are the only supported field type for the inner filter. For Nested filter type, choose the filter type that you want. The filter type that you choose determines the final configuration steps for the nested filter. Available filter types and information about their configuration can be found in the list below. • Filter list • Custom filter list • Custom filter Adding numeric filters Fields with decimal or int data types are considered numeric fields. You create filters on numeric fields by specifying a comparison type, for example Greater than or Between, and a comparison value or values as appropriate to the comparison type. Comparison values must be positive integers and can't contain commas. You can use the following comparison types in numeric filters: • Equals Filter types 542 User Guide Amazon QuickSight • Does not equal • Greater than • Greater than or equal to • Less than • Less than or equal to • Between Note To use a top and bottom filter for numeric data (analyses only), first change the field from a measure to a dimension. Doing this converts the data to text. Then you can use a text filter. For more information, see Adding text filters. In analyses, for datasets based on database queries, you can also optionally apply an aggregate function to the comparison value or values, for example Sum or Average. You can use the following aggregate functions in numeric filters: • Average • Count • Count distinct • Max • Median • Min • Percentile • Standard deviation • Standard deviation - population • Sum • Variance • Variance - population Filter types 543 Amazon QuickSight Creating numeric filters Use the following procedure to create a numeric field filter. To create a numeric field filter User Guide 1. Create a new filter using a text field. For more information about creating filters, see Adding 2. 3. filters. In the Filters pane, choose the new filter to expand it. (Optional) For Aggregation, choose an aggregation. No aggregation is applied by default. This option is available only when creating numeric filters in an analysis. 4. For Filter condition, choose a comparison type. 5. Do one of the following: • If you chose a comparison type other than Between, enter a comparison value. If you chose a comparison type of Between, enter the beginning of the value range in Minimum value and the end of the value range in Maximum value. • (Analyses only) To use an existing parameter, enable Use parameters, then choose your parameter from the list. For parameters to appear in this list, create your parameters first. Usually, you create a parameter, add a control for it, and then add a filter for it. For more information, see Parameters in Amazon QuickSight. The values display alphabetically in the control, unless there are more than 1,000 distinct values. Then the control displays a search box instead. Each time you search for the value that you want to use, it initiates a new query. If the results contain more than 1,000 values, you can scroll through the values with pagination. 6. (Analyses only) For Null options choose Exclude nulls, Include nulls, or Nulls only. 7. When finished, choose Apply. Adding date filters You create filters on date fields by selecting the filter conditions and date values that you want to use. There are three filter types for dates: • Range – A series of dates based on a time range and comparison type. You can filter records based on whether the date field value is before or after a specified date, or within a date range. You enter date values in the format MM/DD/YYYY. You can use the following comparison types: Filter types 544 Amazon QuickSight User Guide • Between – Between a start date and an end date • After – After a specified date • Before – Before a specified date • Equals – On a specified date For each comparison type, you can alternatively choose a rolling date relative to a period or dataset value. • Relative (analyses only) – A series of date and time elements based on the current date. You can filter records based on the current date and your selected unit of measure (UOM). Date filter units include years, quarters, months, weeks, days, hours, and
amazon-quicksight-user-151
amazon-quicksight-user.pdf
151
types 544 Amazon QuickSight User Guide • Between – Between a start date and an end date • After – After a specified date • Before – Before a specified date • Equals – On a specified date For each comparison type, you can alternatively choose a rolling date relative to a period or dataset value. • Relative (analyses only) – A series of date and time elements based on the current date. You can filter records based on the current date and your selected unit of measure (UOM). Date filter units include years, quarters, months, weeks, days, hours, and minutes. You can exclude current period, add support for Next N filters similar to Last N with an added capability to allow for Anchor date. You can use the following comparison types: • Previous – The previous UOM—for example, the previous year. • This – This UOM, which includes all dates and times that fall within the select UOM, even if they occur in the future. • To date or up to now – UOM to date, or UOM up to now. The displayed phrase adapts to the UOM that you choose. However, in all cases this option filters out data that is not between the beginning of the current UOM and the current moment. • Last n – The last specified number of the given UOM, which includes all of this UOM and all of the last n −1 UOM. For example, let's say today is May 10, 2017. You choose to use years as your UOM, and set Last n years to 3. The filtered data includes data for all of 2017, plus all of 2016, and all of 2015. If you have any data for the future dates of the current year (2017 in this example), these records are included in your dataset. • Top and bottom (analyses only) – A number of date entries ranked by another field. You can show the top or bottom n for the type of date or time UOM you choose, based on values in another field. For example, you can choose to show the top 5 sales days based on revenue. Comparisons are applied inclusive to the date specified. For example, if you apply the filter Before 1/1/16, the records returned include all rows with date values through 1/1/16 23:59:59. If you don't want to include the date specified, you can clear the option to Include this date. If you want to omit a time range, you can use the Exclude the last N periods option to specify the number and type of time periods (minutes, days, and so on) to filter out. Filter types 545 Amazon QuickSight User Guide You can also choose to include or exclude nulls, or exclusively show rows that contain nulls in this field. If you pass in a null date parameter (one without a default value), it doesn't filter the data until you provide a value. Note If a column or attribute has no time zone information, then the client query engine sets the default interpretation of that date-time data. For example, suppose that a column contains a timestamp, rather than a timestamptz, and you are in a different time zone than the data's origin. In this case, the engine can render the timestamp differently than you expect. Amazon QuickSight and SPICE both use Universal Coordinated Time (UTC) times. Use the following sections to learn how to create date filters in datasets and analyses. Creating date filters in datasets Use the following procedure to create a range filter for a date field in a dataset. To create a range filter for a date field in a dataset 1. Create a new filter using a text field. For more information about creating filters, see Adding filters. 2. 3. In the Filters pane, choose the new filter to expand it. For Condition, choose a comparison type: Between, After, or Before. To use Between as a comparison, choose Start date and End date and choose dates from the date picker controls that appear. You can choose if you want to include either or both the start and end dates in the range by selecting Include start date or Include end date. To use Before or After comparisons, enter a date or choose the date field to bring up the date picker control and choose a date instead. You can include this date (the one you chose), to exclude the last N time periods, and specify how to handle nulls. 4. For Time granularity, choose Day, Hour, Minute, or Second. 5. When finished, choose Apply. Filter types 546 Amazon QuickSight Creating date filters in analyses You can create date filters in analyses as described following. Creating range date filters in analyses User Guide Use the following procedure to
amazon-quicksight-user-152
amazon-quicksight-user.pdf
152
or Include end date. To use Before or After comparisons, enter a date or choose the date field to bring up the date picker control and choose a date instead. You can include this date (the one you chose), to exclude the last N time periods, and specify how to handle nulls. 4. For Time granularity, choose Day, Hour, Minute, or Second. 5. When finished, choose Apply. Filter types 546 Amazon QuickSight Creating date filters in analyses You can create date filters in analyses as described following. Creating range date filters in analyses User Guide Use the following procedure to create a range filter for a date field in an analysis. To create a range filter for a date field in an analysis 1. Create a new filter using a text field. For more information about creating filters, see Adding 2. 3. 4. filters. In the Filters pane, choose the new filter to expand it. For Filter type, choose Date & time range. For Condition, choose a comparison type: Between, After, Before, or Equals. To use Between as a comparison, choose Start date and End date and choose dates from the date picker controls that appear. You can choose to include either or both the start and end dates in the range by selecting Include start date or Include end date. To use a Before, After, or Equals comparison, enter a date or choose the date field to bring up the date picker control and choose a date instead. You can include this date (the one you chose), to exclude the last N time periods, and specify how to handle nulls. To Set a rolling date for your comparison, choose Set a rolling date. In the Set a rolling date pane that opens, choose Relative date and then select if you want to set the date to Today, Yesterday, or you can specify the Filter condition (start of or end of), Range (this, previous, or next), and Period (year, quarter, month, week, or day). 5. For Time granularity, choose Day, Hour, Minute, or Second. Filter types 547 Amazon QuickSight User Guide 6. (Optional) If you are filtering by using an existing parameter, instead of specific dates, choose Use parameters, then choose your parameter or parameters from the list. To use Before, After, or Equals comparisons, choose one date parameter. You can include this date in the range. To use Between, enter both the start date and end date parameters separately. You can include the start date, the end date, or both in the range. To use parameters in a filter, create them first. Usually, you create a parameter, add a control for it, and then add a filter for it. For more information, see Parameters in Amazon QuickSight. 7. For Null options choose Exclude nulls, Include nulls, or Nulls only. 8. When finished, choose Apply. Creating relative date filters in analyses Use the following procedure to create a relative filter for a date field in an analysis. To create a relative filter for a date field in an analysis 1. Create a new filter using a text field. For more information about creating filters, see Adding 2. 3. 4. 5. 6. 7. 8. filters. In the Filters pane, choose the new filter to expand it. For Filter type, choose Relative dates. For Time granularity, choose a granularity of time that you want to filter by (days, hours, minutes). For Period, choose a unit of time (years, quarters, quarters, months, weeks, days). For Range, choose how you want the filter to relate to the time frame. For example, if you choose to report on months, your options are previous month, this month, month to date, last N months, and next N months. If you choose Last N or Next N years, quarters, months, weeks, or days, enter a number for Number of. For example, last 3 years, next 5 quarters, last 5 days. For Null options choose Exclude nulls, Include nulls, or Nulls only. For Set dates relative to, choose one of the following options: • Current date time – If you choose this option, you can set it to Exclude last, and then specify the number and type of time periods. Filter types 548 Amazon QuickSight User Guide • Date and time from a parameter – If you choose this option, you can select an existing datetime parameter. 9. (Optional) If you are filtering by using an existing parameter, instead of specific dates, enable Use parameters, then choose your parameter or parameters from the list. To use parameters in a filter, create them first. Usually, you create a parameter, add a control for it, and then add a filter for it. For more information, see Parameters in Amazon QuickSight. 10. When finished, choose Apply. Creating top and bottom date filters
amazon-quicksight-user-153
amazon-quicksight-user.pdf
153
periods. Filter types 548 Amazon QuickSight User Guide • Date and time from a parameter – If you choose this option, you can select an existing datetime parameter. 9. (Optional) If you are filtering by using an existing parameter, instead of specific dates, enable Use parameters, then choose your parameter or parameters from the list. To use parameters in a filter, create them first. Usually, you create a parameter, add a control for it, and then add a filter for it. For more information, see Parameters in Amazon QuickSight. 10. When finished, choose Apply. Creating top and bottom date filters in analyses Use the following procedure to create a top and bottom filter for a date field in an analysis. To create a top and bottom filter for a date field in an analysis 1. Create a new filter using a text field. For more information about creating filters, see Adding 2. 3. 4. 5. 6. 7. 8. filters. In the Filters pane, choose the new filter to expand it. For Filter type, choose Top and bottom. Select Top or Bottom. For Show, enter the number of top or bottom items you want to show and choose a unit of time (years, quarters, months, weeks days, hours, minutes). For By, choose a field to base the ranking on. (Optional) Add another field as a tie breaker, if the field for By has duplicates. Choose Tie breaker, and then choose another field. To remove a tie breaker, use the delete icon. (Optional) If you are filtering by using an existing parameter, instead of specific dates, select Use parameters, then choose your parameter or parameters from the list. To use a parameter for Top and bottom, choose an integer parameter for the number of top or bottom items to show. To use parameters in a filter, create them first. Usually, you create a parameter, add a control for it, and then add a filter for it. For more information, see Parameters in Amazon QuickSight. 9. When finished, choose Apply. Filter types 549 Amazon QuickSight User Guide Adding filter conditions (group filters) with AND and OR operators In analyses, when you add multiple filters to a visual, Amazon QuickSight uses the AND operator to combine them. You can also add filter conditions to a single filter with the OR operator. This is called a compound filter, or filter group. To add multiple filters using the OR operator, create a filter group. Filter grouping is available for all types of filters in analyses. When you filter on multiple measures (green fields marked with #), you can apply the filter conditions to an aggregate of that field. Filters in a group can contain either aggregated or nonaggregated fields, but not both. To create a filter group 1. Create a new filter in an analysis. For more information about creating filters, see Adding 2. 3. filters. In the Filters pane, choose the new filter to expand it. In the expanded filter, choose Add filter condition at bottom, and then choose a field to filter on. 4. Choose the conditions to filter on. The data type of the field that you selected determines the options available here. For example, if you chose a numeric field, you can specify the aggregation, filter condition, and values. If you chose a text field, you can chose the filter type, filter condition, and values. And if you chose a date field, you can specify the filter type, condition, and time granularity. For more information about these options, see Filter types in Amazon QuickSight. 5. (Optional) You can add additional filter conditions to the filter group by choosing Add filter condition again at bottom. 6. (Optional) To remove a filter from the filter group, choose the trash-can icon near the field name. 7. When finished, choose Apply. The filters appear as a group in the Filters pane. Filter types 550 Amazon QuickSight Creating cascading filters User Guide The idea behind cascading any action, such as a filter, is that choices in the higher levels of a hierarchy affect the lower levels of a hierarchy. The term cascading comes from the way that a cascade waterfall flows from one tier to the next. To set up cascading filters, you need a trigger point where the filter is activated, and target points where the filter is applied. In Amazon QuickSight, the trigger and target points are included in visuals. To create a cascading filter, you set up an action, not a filter. This approach is because you need to define how the cascading filter is activated, which fields are involved, and which visuals are filtered when someone activates it. For more information, including step-by-step instructions, see Using custom actions for filtering and navigating. There are two other ways to activate a filter across multiple
amazon-quicksight-user-154
amazon-quicksight-user.pdf
154
To set up cascading filters, you need a trigger point where the filter is activated, and target points where the filter is applied. In Amazon QuickSight, the trigger and target points are included in visuals. To create a cascading filter, you set up an action, not a filter. This approach is because you need to define how the cascading filter is activated, which fields are involved, and which visuals are filtered when someone activates it. For more information, including step-by-step instructions, see Using custom actions for filtering and navigating. There are two other ways to activate a filter across multiple visuals: • For a filter that is activated from a widget on a dashboard – The widget is called a sheet control, which is a custom menu that you can add to the top of your analysis or dashboard. The most common sheet control is a drop-down list, which displays a list of options to choose from when you open it. To add one of these to your analysis, create a parameter, add a control to the parameter, and then add a filter that uses the parameter. For more information, see Setting up parameters in Amazon QuickSight, Using a control with a parameter in Amazon QuickSight, and Adding filter controls to analysis sheets. • For a filter that always applies to multiple visuals – This is a regular filter, except that you set its scope to apply to multiple (or all) visuals. This type of filter doesn't really cascade, because there is no trigger point. It always filters all the visuals that it's configured to filter. To add this type of filter to your analysis, create or edit a filter and then choose its scope: Single visual, Single sheet, or Cross sheets. Note the option to Apply cross-datasets. If this box is checked, then the filter will be applied to all visuals from different datasets that are applicable on all sheets in the filter scope. For more information, see Filters. Adding filter controls to analysis sheets When you're designing an analysis, you can add a filter to the analysis sheet near the visuals that you want to filter. It appears in the sheet as a control that dashboard viewers can use when you publish the analysis as a dashboard. The control uses the analysis theme settings so it looks like it's part of the sheet. Adding filter controls 551 Amazon QuickSight User Guide Filter controls share some settings with their filters. They apply to one, some, or all of the objects on the same sheet. Use the following sections add and customize filter controls to an analysis. To learn how to add cross-sheet controls, see Controls. Topics • Adding filter controls • Pinning filter controls to the top of a sheet • Customizing filter controls • Cascading filter controls Adding filter controls Use the following procedure to add a filter control. To add a filter control 1. Open the QuickSight console. 2. From the QuickSight start page, choose Analyses, and then choose the analysis that you want to work with. Adding filter controls 552 Amazon QuickSight User Guide 3. In the analysis, choose Filter at left. Adding filter controls 553 Amazon QuickSight User Guide 4. If you don't already have some filters available, create one. For more information about creating filters, see Adding filters. 5. In the Filters pane, choose the three dots to the right of the filter that you want to add a control for, and choose Add to sheet. The filter control is added to the sheet, usually at the bottom. You can resize it or drag it to different positions on the sheet. You can also customize how it appears and how dashboard viewers can interact with it. For more information about customizing filter controls, see the following sections. Adding filter controls 554 Amazon QuickSight User Guide Pinning filter controls to the top of a sheet Use the following procedure to pin filter controls to the top of a sheet. To pin a control to the top of a sheet 1. On the filter control that you want to move, choose the three dots next to the pencil icon and choose Pin to top. The filter is pinned to the top of the sheet and is collapsed. You can click it to expand it. 2. (Optional) To unpin the control, expand it and hover over it at the top of the sheet until three dots appear. Choose the three dots, and then choose Move to sheet. Customizing filter controls Depending on the data type of the field and the type of filter, filter controls have different settings available. You can customize how they appear in the sheet and how dashboard viewers can interact with them. Adding filter controls 555 Amazon QuickSight To customize a filter control
amazon-quicksight-user-155
amazon-quicksight-user.pdf
155
is pinned to the top of the sheet and is collapsed. You can click it to expand it. 2. (Optional) To unpin the control, expand it and hover over it at the top of the sheet until three dots appear. Choose the three dots, and then choose Move to sheet. Customizing filter controls Depending on the data type of the field and the type of filter, filter controls have different settings available. You can customize how they appear in the sheet and how dashboard viewers can interact with them. Adding filter controls 555 Amazon QuickSight To customize a filter control 1. Choose the filter control in the sheet. 2. On the filter control, choose the pencil icon. User Guide If the filter control is pinned to the top of the sheet, expand it and hover your cursor over it until the three dots appear. Choose the three dots, and then choose Edit. 3. In the Format control pane that opens, do the following: a. b. c. For Display name, enter a name for the filter control. (Optional) To hide the display name from the filter control, clear the check box for Show title. For Title font size, choose the title font size that you want to use. The options range from extra small to extra large. The default setting is medium. The remaining steps depend on the type of field the control is referencing. For options by filter type, see the following sections. Date filters If your filter control is from a date filter, use the following procedure to customize the remaining options. To customize further options for a date filter 1. In the Format control pane, for Style, choose one of the following options: • Date picker – range – Displays a set of two fields to define a time range. You can enter a date or time, or you can choose a date from the calendar control. You can also customize how you want the dates to appear in the control by entering a date token for Date format. For more information, see Customizing date formats in Amazon QuickSight. • Date picker – relative – Displays settings like the time period, its relation to the current date and time, and the option to exclude time periods. You can also customize how you Adding filter controls 556 Amazon QuickSight User Guide want the dates to appear in the control by entering a date token for Date format. For more information, see Customizing date formats in Amazon QuickSight. • Text field – Displays a box where you can enter the top or bottom N date. Helper text is included in the text field control by default, but you can choose to remove it by clearing the Show helper text in control option. By default, QuickSight visuals are reloaded whenever a change is made to a control. For Calendar and Relative date picker controls, authors can add an Apply button to a control that delays visual reload until the user chooses Apply. This allows users to make multiple changes at a time without additional queries. This setting can be configured with the Show an apply button checkbox in the Control options section of the Format control pane. 2. When finished, choose Apply. Text filters If your filter control is from a text filter, for example dimensions, categories, or labels, use the following procedure to customize the remaining options. To customize further options for a text filter 1. In the Format control pane, for Style, choose one of the following options: • Dropdown – Displays a dropdown list with buttons that you can use to select a single value. When you select this option, you can choose the following options for Values: • Filter – Displays all the values that are available in the filter. • Specific values – Enables you to enter the values to display, one entry per line. You can also choose to Hide Select all option from the control values. This removes the option to select or clear the selection of all values in the filter control. • Dropdown - multiselect – Displays a dropdown list with boxes that you can use to select multiple values. When you select this option, you can choose the following options for Values: • Filter – Displays all the values that are available in the filter. • Specific values – Enables you to enter the values to display, one entry per line. Adding filter controls 557 Amazon QuickSight User Guide By default, QuickSight visuals are reloaded whenever a change is made to a control. For Multiselect dropdown controls, authors can add an Apply button to a control that delays visual reload until the user chooses Apply. This allows users to make multiple changes at a time without additional queries. This setting can
amazon-quicksight-user-156
amazon-quicksight-user.pdf
156
select this option, you can choose the following options for Values: • Filter – Displays all the values that are available in the filter. • Specific values – Enables you to enter the values to display, one entry per line. Adding filter controls 557 Amazon QuickSight User Guide By default, QuickSight visuals are reloaded whenever a change is made to a control. For Multiselect dropdown controls, authors can add an Apply button to a control that delays visual reload until the user chooses Apply. This allows users to make multiple changes at a time without additional queries. This setting can be configured with the Show an apply button checkbox in the Control options section of the Format control pane. • List – Displays a list with buttons that you can use to select a single value. When you select this option, you can choose the following options for Values: • Filter – Displays all the values that are available in the filter. • Specific values – Enables you to enter the values to display, one entry per line. You can also choose the following: • Hide search bar when control is on sheet – Hides the search bar in the filter control, so users can't search for specific values. • Hide Select all option from the control values – Removes the option to select or clear the selection of all values in the filter control. • List - multiselect – Displays a list with boxes that you can use to select multiple values. When you select this option, you can choose the following options for Values: • Filter – Displays all the values that are available in the filter. • Specific values – Enables you to enter the values to display, one entry per line. You can also choose the following: • Hide search bar when control is on sheet – Hides the search bar in the filter control, so users can't search for specific values. • Hide Select all option from the control values – Removes the option to select or clear the selection of all values in the filter control. • Text field – Displays a text box where you can enter a single entry. Text fields support up to 79950 characters. When you select this option, you can choose the following: • Show helper text in control – Removes the helper text in text fields. • Text field - multiline – Displays a text box where you can enter multiple entries. Multiline text fields support up to 79950 characters across all entries. Adding filter controls 558 Amazon QuickSight User Guide When you select this option, you can choose the following: • For Separate values by, choose how you want to separate values you enter into the filter control. You can choose to separate values by a line break, comma, pipe (|), or semicolon. • Show helper text in control – Removes the helper text in text fields. 2. When finished, choose Apply. Numeric filters If your filter control is from a numeric filter, use the following procedure to customize the remaining options. To customize further options for a numeric filter 1. In the Format control pane, for Style, choose one of the following options: • Dropdown – Displays a list where you can select a single value. When you select this option, you can choose the following options for Values: • Filter – Displays all the values that are available in the filter. • Specific values – Enables you to enter the values to display, one entry per line. You can also choose to Hide Select all option from the control values. This removes the option to select or clear the selection of all values in the filter control. • Filter – Displays all the values that are available in the filter. • Specific values – Enables you to enter the values to display, one entry per line. • Hide Select all option from the control values – Removes the option to select or clear the selection of all values in the filter control. • List – Displays a list with buttons that enable selecting a single value. When you select this option, you can choose the following options for Values: • Filter – Displays all the values that are available in the filter. • Specific values – Enables you to enter the values to display, one entry per line. You can also choose the following: • Hide search bar when control is on sheet – Hides the search bar in the filter control, so users can't search for specific values. Adding filter controls 559 Amazon QuickSight User Guide • Hide Select all option from the control values – Removes the option to select or clear the selection of all values in the filter control. • Slider
amazon-quicksight-user-157
amazon-quicksight-user.pdf
157
following options for Values: • Filter – Displays all the values that are available in the filter. • Specific values – Enables you to enter the values to display, one entry per line. You can also choose the following: • Hide search bar when control is on sheet – Hides the search bar in the filter control, so users can't search for specific values. Adding filter controls 559 Amazon QuickSight User Guide • Hide Select all option from the control values – Removes the option to select or clear the selection of all values in the filter control. • Slider – Displays a horizontal bar with a toggle that you can slide to change the value. If you have a ranged filter for values between a minimum and a maximum, the slider provides a toggle for each number. For sliders, you can specify the following options: • Minimum value – Displays the smaller value at the left of the slider. • Maximum value – Displays the larger value at the right of the slider. • Step size – Enables you to set the number of increments that the bar is divided into. • Text box – Displays a box where you can enter the value. When you select this option, you can choose the following: • Show helper text in control – Removes the helper text in text fields. 2. When finished, choose Apply. Cascading filter controls You can limit the values displayed in the control, so they only show values that are valid for what is selected in other controls. This is called a cascading control. When creating cascading controls, the following limitations apply: 1. Cascading controls must be tied to dataset columns from the same dataset. 2. 3. 4. The child control must be a dropdown or list control. For parameter controls, the child control must be linked to a dataset column. For filter controls, the child control must be linked to a filter (instead of showing only specific values). 5. The parent control must be one of the following: a. A string, integer, or numeric parameter control. b. A string filter control (excluding top-bottom filters). c. A non-aggregated numeric filter control. d. A date filter control (excluding top-bottom filters). Adding filter controls 560 Amazon QuickSight To create a cascading control User Guide 1. Choose Show relevant values only. Note that this option might not be available for all filter control types. 2. In the Show relevant values only pane that opens, choose one or more controls from the available list. 3. Choose a field to match the value to. 4. Choose Update. Editing filters You can edit filters at any time in a dataset or analysis. You can't change the field a filter applies to. To apply a filter to a different field, create a new filter instead. Use the following procedures to learn how to edit filters. Editing filters in datasets Use the following procedure to edit filters in datasets. To edit a filter in a dataset 1. Open the QuickSight console. 2. From the QuickSight start page, choose Datasets. 3. Choose the dataset that you want, and then choose Edit dataset. 4. On the data preparation page that opens, choose Filters at lower left. Editing filters 561 Amazon QuickSight User Guide 5. Choose the filter that you want to edit. 6. When finished editing, choose Apply. Editing filters in analyses Use the following procedure to edit filters in analyses. To edit a filter in an analysis 1. Open the QuickSight console. 2. From the QuickSight start page, choose Analyses. 3. On the Analyses page, choose the analysis that you want to work with. Editing filters 562 Amazon QuickSight User Guide 4. In the analysis, choose the Filter icon shown below to open the Filters pane. 5. Choose the filter that you want to edit. 6. When finished editing, choose Apply. Enabling or disabling filters You can use the filter menu to enable or disable a filter in a dataset or an analysis. When you create a filter, it's enabled by default. Disabling a filter removes the filter from the field, but it doesn't delete the filter from the dataset or analysis. Disabled filters are grayed out in the filters pane. If you want to re-apply the filter to the field, you can simply enable it. Use the following procedures to learn how to enable or disable filters. Disabling filters in datasets Use the following procedure to disable filters in datasets. To disable a filter in a dataset 1. From the QuickSight start page, choose Datasets. 2. Choose the dataset that you want, and then choose Edit dataset. 3. On the data preparation page that opens, choose Filters at lower left. Enabling or disabling filters 563 Amazon QuickSight User Guide 4. In the Filters pane at
amazon-quicksight-user-158
amazon-quicksight-user.pdf
158
out in the filters pane. If you want to re-apply the filter to the field, you can simply enable it. Use the following procedures to learn how to enable or disable filters. Disabling filters in datasets Use the following procedure to disable filters in datasets. To disable a filter in a dataset 1. From the QuickSight start page, choose Datasets. 2. Choose the dataset that you want, and then choose Edit dataset. 3. On the data preparation page that opens, choose Filters at lower left. Enabling or disabling filters 563 Amazon QuickSight User Guide 4. In the Filters pane at left, choose the three dots to the right of the filter that you want to disable, and then choose Disable. To enable a filter that was disabled, choose Enable. Disabling filters in analyses Use the following procedure to disable filters in analyses. To disable a filter in an analysis 1. Open the QuickSight console. 2. From the QuickSight start page, choose Analyses. 3. On the Analyses page, choose the analysis that you want to work with. Enabling or disabling filters 564 Amazon QuickSight User Guide 4. In the analysis, choose the Filter icon shown below to open the Filters pane. 5. In the Filters pane that opens, choose the three dots to the right of the filter that you want to disable, and then choose Disable. To enable a filter that was disabled, choose Enable. Deleting filters You can delete filters at any time in a dataset or analysis. Use the following procedures to learn how. Deleting filters in datasets Use the following procedure to delete filters in datasets. To delete a filter in a dataset 1. Open the QuickSight console. 2. From the QuickSight start page, choose Datasets. 3. Choose the dataset that you want, and then choose Edit dataset. 4. On the data preparation page that opens, choose Filters at lower left. Deleting filters 565 Amazon QuickSight User Guide 5. Choose the filter that you want to delete, and then choose Delete filter. Deleting filters in analyses Use the following procedure to delete filters in analyses. To delete a filter in an analysis 1. Open the QuickSight console. 2. From the QuickSight start page, choose Analyses. 3. On the Analyses page, choose the analysis that you want to work with. 4. In the analysis, choose the Filter icon shown below to open the Filters pane. Deleting filters 566 Amazon QuickSight User Guide 5. Choose the filter that you want to delete, and then choose Delete filter. Using SQL to customize data When you create a dataset or prepare your data for use in an analysis, you can customize the data in the query editor. The query editor is made up of multiple components, as follows: • Query mode – At the top left, you can choose between direct query or SPICE query modes: • Direct query – To run the SELECT statement directly against the database • SPICE – To run the SELECT statement against data that was previously stored in memory • Fields – Use this section to disable fields you want to remove from the final dataset. You can add calculated fields in this section, and augment your data with SageMaker AI • Query archive – Use this section to find previous version of your SQL queries. • Filters – Use this section to add, edit, or remove filters. • Schema explorer – This section only appears while you are editing SQL. You can use it to explore your schemas, tables, fields, and data types. • SQL editor – Use this to edit your SQL. The SQL editor, which offers syntax highlighting, basic autocomplete, autoindent, and line numbering. You can specify a SQL query only for datasets that come from data sources compatible with SQL. Your SQL must conform to the target database requirements regarding syntax, capitalization, command termination, and so on. If you prefer, you can instead paste SQL from another editor. • Data workspace – When the SQL editor is closed, the data workspace displays at top right with a grid background. Here you can see a graphical representation of your data objects, including queries, tables, files, and joins created in the join editor. To view details about each table, use the data source options menu and choose Table details or Edit SQL Query. Details display for table name and alias, schema, data source name, and data source type. For upload settings on a file, choose Configure upload settings from the data source options menu to view or change the following settings: • Format – the file format, CSV, CUSTOM, CLF, and so on Using SQL to customize data 567 Amazon QuickSight User Guide • The starting row – the row to start with • The text qualifier – double quote or single quote
amazon-quicksight-user-159
amazon-quicksight-user.pdf
159
To view details about each table, use the data source options menu and choose Table details or Edit SQL Query. Details display for table name and alias, schema, data source name, and data source type. For upload settings on a file, choose Configure upload settings from the data source options menu to view or change the following settings: • Format – the file format, CSV, CUSTOM, CLF, and so on Using SQL to customize data 567 Amazon QuickSight User Guide • The starting row – the row to start with • The text qualifier – double quote or single quote • Header – indicates if the file includes a header row • Preview rows – A preview of the sampled rows appear at bottom right when the join configuration editor isn't in use. • Join configuration editor – The join editor opens when you have more than one data object in the data workspace. To edit a join, you select the join icon between two tables (or files). Choose a join type and the fields to join on, by using the join configuration panel at the bottom of the screen. Then choose Apply to create the join. You must complete all joins before you can save your work. To add more queries, tables, or files, use the Add data option above the workspace. Creating a basic SQL query Use the following procedure to connect to a data source by using a custom SQL query. To create a basic SQL query 1. Create a new data source and validate the connection. 2. Fill in the options necessary to connection, however you don't need to select a schema or a table. 3. Choose Use custom SQL. 4. (Optional) You can enter your query in the SQL editor, or continue on to the next step to use the full-screen version. To enter it now, create a name for the query. Then type or paste a SQL query into the editor. The SQL editor offers syntax highlighting, basic autocomplete, autoindent, and line numbering. (Optional) Choose Confirm query to validate it and view settings for direct query, SPICE memory, and SageMaker AI settings. 5. Choose Edit/Preview data. The full query editor appears with the SQL editor displayed. The query is processed and a sample of the query results displays in the data preview pane. You can make changes to the SQL and confirm them by choosing Apply. When you are done with the SQL, choose Close to continue. 6. At the top, enter a name for the dataset. Then choose Save & visualize. Creating a basic SQL query 568 Amazon QuickSight Modifying existing queries To update a SQL query User Guide 1. Open the dataset that you want to work with. 2. In the workspace with the grid, locate the box-shaped object that represents the existing query. 3. Open the options menu on the query object and choose Edit SQL query. If this option doesn't appear in the list, the query object isn't based on SQL. To view previous versions of queries, open the Query archive at left. Adding geospatial data You can flag geographic fields in your data, so that Amazon QuickSight can display them on a map. Amazon QuickSight can chart latitude and longitude coordinates. It also recognizes geographic components such as country, state or region, county or district, city, and ZIP code or postal code. You can also create geographic hierarchies that can disambiguate similar entities, for example the same city name in two states. Note Geospatial charts in Amazon QuickSight aren't currently supported in some AWS Regions, including in China. We are working on adding support for more Regions. Use the following procedures to add geospatial data types and hierarchies to your dataset. To add geospatial data types and hierarchies to your dataset 1. On the data preparation page, label the geographic components with the correct data type. There are several ways to do this. One is to choose the field under Fields and use the ellipses icon (…) to open the context menu. Adding geospatial data 569 Amazon QuickSight User Guide Then choose the correct geospatial data type. You can also change the data type in the work area with the data sample. To do this, choose the data type listed under the field name. Then choose the data type you want to assign. 2. Verify that all geospatial fields necessary for mapping are labeled as geospatial data types. You can check this by looking for the place marker icon. This icon appears under the field names across the top of the page, and also in the Fields pane on the left. Also check the name of the data type, for example latitude or country. Adding geospatial data 570 Amazon QuickSight User Guide 3. (Optional) You can set up a
amazon-quicksight-user-160
amazon-quicksight-user.pdf
160
the data sample. To do this, choose the data type listed under the field name. Then choose the data type you want to assign. 2. Verify that all geospatial fields necessary for mapping are labeled as geospatial data types. You can check this by looking for the place marker icon. This icon appears under the field names across the top of the page, and also in the Fields pane on the left. Also check the name of the data type, for example latitude or country. Adding geospatial data 570 Amazon QuickSight User Guide 3. (Optional) You can set up a hierarchy or grouping for geographical components (state, city), or for latitude and longitude coordinates. For coordinates, you must add both latitude and longitude to the geospatial field wells. To create a hierarchy or grouping, first choose one of these fields in the Fields pane. Each field can only belong to one hierarchy. It doesn't matter which one you choose first, or what order you add the fields in. Choose the ellipsis icon (…) next to the field name. Then choose Add to a hierarchy. 4. On the Add field to hierarchy screen, choose one of the following: • Choose Create a new geospatial hierarchy to create a new grouping. • Choose Add to existing geospatial hierarchy to add a field to a grouping that already exists. The existing hierarchies displayed include only those of matching geospatial types. Choose Add to confirm your choice. Adding geospatial data 571 Amazon QuickSight User Guide 5. On the Create hierarchy screen, name your hierarchy. If you are creating a latitude and longitude grouping, the Create hierarchy screen appears as follows. Depending on whether you chose latitude or longitude in the previous steps, either latitude or longitude displays on this screen. Make sure that your latitude field shows under Field to use for latitude. Also make sure that your longitude shows under Field to use for longitude. For geographical components, the Create hierarchy screen has two choices: • Choose This hierarchy is for a single country if your data only contains one country. Choose the specific country from the list. Your data doesn't need to contain every level of the hierarchy. You can add fields to the hierarchy in any order. • Choose This hierarchy is for multiple countries if your data contains more than one country. Choose the field that contains the country names. Adding geospatial data 572 Amazon QuickSight User Guide For either hierarchy type, choose Update to continue. 6. Continue by adding as many fields to the hierarchy as you need to. Your geospatial groupings appear in the Fields pane. Adding geospatial data 573 Amazon QuickSight User Guide Changing a geospatial grouping You can change a geospatial hierarchy or grouping that exists in a dataset. Use the following procedure to edit or disband a geospatial hierarchy. To edit or disband a geospatial hierarchy 1. Open the dataset. In the Fields pane, choose the hierarchy name. 2. Choose the ellipsis icon (...), then choose one of the following options. Choose Disband hierarchy to remove the hierarchy from the dataset. You can't undo this operation. However, you can recreate your hierarchy or grouping by starting again at step 1. Disbanding the hierarchy doesn't remove any fields from the dataset. Choose Edit hierarchy to make changes to the hierarchy. Doing this reopens the creation screens, so you can make different choices in rebuilding your hierarchy. Geospatial troubleshooting Use this section to discover the Amazon QuickSight requirements for correctly processing geospatial data. If Amazon QuickSight doesn't recognize your geospatial data as geospatial, use this section to help troubleshoot the issue. Make sure that your data follows the guidelines listed, so that it works in geospatial visuals. Note Geospatial charts in Amazon QuickSight currently aren't supported in some AWS Regions, including in China. We are working on adding support for more Regions. Changing a geospatial grouping 574 Amazon QuickSight User Guide If your geography follows all the guidelines listed here, and still generates errors, contact the Amazon QuickSight team from within the Amazon QuickSight console. Topics • Geocoding issues • Issues with latitude and longitude • Supported administrative areas and postal codes by country Geocoding issues Amazon QuickSight geocodes place names into latitude and longitude coordinates. It uses these coordinates to display place names on the map. Amazon QuickSight skips any places that it can't geocode. For this process to work properly, your data must include at least the country. Also, there can't be duplicate place names inside of a parent place name. A few issues prevent place names from showing up on a map chart. These issues include unsupported, ambiguous, or invalid locations, as described following. Topics • Issues with unsupported areas • Issues with ambiguous locations • Issues with invalid geospatial data • Issues with
amazon-quicksight-user-161
amazon-quicksight-user.pdf
161
QuickSight geocodes place names into latitude and longitude coordinates. It uses these coordinates to display place names on the map. Amazon QuickSight skips any places that it can't geocode. For this process to work properly, your data must include at least the country. Also, there can't be duplicate place names inside of a parent place name. A few issues prevent place names from showing up on a map chart. These issues include unsupported, ambiguous, or invalid locations, as described following. Topics • Issues with unsupported areas • Issues with ambiguous locations • Issues with invalid geospatial data • Issues with the default country in geocoding Issues with unsupported areas To map unsupported locations, include latitude and longitude coordinates in your data. Use these coordinates in the geospatial field well to make locations show on a map chart. Issues with ambiguous locations Geospatial data can't contain ambiguous locations. For example, suppose that the data contains a city named Springfield, but the next level in the hierarchy is country. Because multiple states Geospatial troubleshooting 575 Amazon QuickSight User Guide have a city named Springfield, it isn't possible to geocode the location to a specific point on a map. To avoid this problem, you can add enough geographical data to indicate what location should show on a map chart. For example, you can add a state level into your data and its hierarchy. Or, you might add latitude and longitude. Issues with invalid geospatial data Invalid geospatial data occurs when a place name (a city, for example) is listed under an incorrect parent (a state, for example). This issue might be a simple misspelling, or data entry error. Note Amazon QuickSight doesn't support regions (for example, West Coast or South) as geospatial data. However, you can use a region as a filter in a visual. Issues with the default country in geocoding Make sure that you are using the correct default country. The default for each hierarchy is based on the country or country field that you choose when you create the hierarchy. To change this default, you can return to the Create hierarchy screen. Then edit or create a hierarchy, and choose a different country. If you don't create a hierarchy, your default country is based on your AWS Region. For details, see the following table. Region Default country US West (Oregon) Region US US East (Ohio) Region US East (N. Virginia) Region Asia Pacific (Singapore) Singapore Geospatial troubleshooting 576 Amazon QuickSight Region Asia Pacific (Sydney) Europe (Ireland) Region Default country Australia Ireland User Guide Issues with latitude and longitude Amazon QuickSight uses latitude and longitude coordinates in the background to find place names on a map. However, you can also use coordinates to create a map without using place names. This approach also works with unsupported place names. Latitude and longitude values must be numeric. For example, the map point indicated by 28.5383355 -81.3792365 is compatible with Amazon QuickSight. But 28° 32' 18.0096'' N 81° 22' 45.2424'' W is not. Topics • Valid ranges for latitude and longitude coordinates • Using coordinates in degrees, minutes, and seconds (DMS) format Valid ranges for latitude and longitude coordinates Amazon QuickSight supports latitude and longitude coordinates within specific ranges. Coordinate Latitude Longitude Valid range Between -90 and 90 Between -180 to 180 Amazon QuickSight skips any data outside these ranges. Out-of-range points can't be mapped on a map chart. Geospatial troubleshooting 577 Amazon QuickSight User Guide Using coordinates in degrees, minutes, and seconds (DMS) format You can use a calculated field with a formula to create a numeric latitude and longitude out of character strings. Use this section to find different ways that you can create calculated fields in Amazon QuickSight, to parse GPS latitude and longitude into numeric latitude and longitude. The following sample converts latitude and longitude to numeric format from separate fields. For example, suppose that you parse 51° 30' 26.4636'' N 0° 7' 39.9288'' W using space as a delimiter. In this case, you can use something like the following sample to convert the resulting fields to numeric latitude and longitude. In this example, the seconds are followed by two single quotation marks. If your data has a double quotation mark instead, then you can use strlen(LatSec)-1) instead of strlen(LatSec)-2). /*Latitude*/ ifelse( LatDir = "N", parseInt(split(LatDeg, "°", 1)) + (parseDecimal(split(LatMin, "'", 1) ) /60) + (parseDecimal((substring(LatSec, 1, strlen(LatSec)-2) ) ) /3600), (parseInt(split(LatDeg, "°", 1)) + (parseDecimal(split(LatMin, "'", 1) ) /60) + (parseDecimal((substring(LatSec, 1, strlen(LatSec)-2) ) ) /3600)) * -1 ) /*Longitude*/ ifelse( LongDir = "E", parseInt(split(LongDeg, "°", 1)) + (parseDecimal(split(LongMin, "'", 1) ) /60) + (parseDecimal((substring(LongSec, 1, strlen(LongSec)-2) ) ) /3600), (parseInt(split(LongDeg, "°", 1)) + (parseDecimal(split(LongMin, "'", 1) ) /60) + (parseDecimal((substring(LongSec, 1, strlen(LongSec)-2) ) ) /3600)) * -1 ) If your data doesn't include the symbols for degree, minute
amazon-quicksight-user-162
amazon-quicksight-user.pdf
162
mark instead, then you can use strlen(LatSec)-1) instead of strlen(LatSec)-2). /*Latitude*/ ifelse( LatDir = "N", parseInt(split(LatDeg, "°", 1)) + (parseDecimal(split(LatMin, "'", 1) ) /60) + (parseDecimal((substring(LatSec, 1, strlen(LatSec)-2) ) ) /3600), (parseInt(split(LatDeg, "°", 1)) + (parseDecimal(split(LatMin, "'", 1) ) /60) + (parseDecimal((substring(LatSec, 1, strlen(LatSec)-2) ) ) /3600)) * -1 ) /*Longitude*/ ifelse( LongDir = "E", parseInt(split(LongDeg, "°", 1)) + (parseDecimal(split(LongMin, "'", 1) ) /60) + (parseDecimal((substring(LongSec, 1, strlen(LongSec)-2) ) ) /3600), (parseInt(split(LongDeg, "°", 1)) + (parseDecimal(split(LongMin, "'", 1) ) /60) + (parseDecimal((substring(LongSec, 1, strlen(LongSec)-2) ) ) /3600)) * -1 ) If your data doesn't include the symbols for degree, minute and second, the formula looks like the following. /*Latitude*/ ifelse( Geospatial troubleshooting 578 Amazon QuickSight LatDir = "N", (LatDeg + (LatMin / 60) + (LatSec / 3600)), (LatDeg + (LatMin / 60) + (LatSec / 3600)) * -1 User Guide ) /*Longitude*/ ifelse( LongDir = "E", (LongDeg + (LongMin / 60) + (LongSec / 3600)), (LongDeg + (LongMin / 60) + (LongSec / 3600)) * -1 ) The following sample converts 53°21'N 06°15'W to numeric format. However, without the seconds, this location doesn't map as accurately. /*Latitude*/ ifelse( right(Latitude, 1) = "N", (parseInt(split(Latitude, '°', 1)) + parseDecimal(substring(Latitude, (locate(Latitude, '°',3)+1), 2) ) / 60) , (parseInt(split(Latitude, '°', 1)) + parseDecimal(substring(Latitude, (locate(Latitude, '°',3)+1), 2) ) / 60) * -1 ) /*Longitude*/ ifelse( right(Longitude, 1) = "E", (parseInt(split(Longitude, '°', 1)) + parseDecimal(substring(Longitude, (locate(Longitude, '°',3)+1), 2) ) / 60) , (parseInt(split(Longitude, '°', 1)) + parseDecimal(substring(Longitude, (locate(Longitude, '°',3)+1), 2) ) / 60) * -1 ) The formats of GPS latitude and longitude can vary, so customize your formulas to match your data. For more information, see the following: • Degrees Minutes Seconds to Decimal Degrees on LatLong.net • Converting Degrees/Minutes/Seconds to Decimals using SQL on Stack Overflow • Geographic Coordinate Conversion on Wikipedia Geospatial troubleshooting 579 Amazon QuickSight User Guide Supported administrative areas and postal codes by country The following is a list of supported administrative areas by country. Supported administrative areas Country name Country code Country State County City Aruba Afghanistan ABW AFG Country Regions Zones Country Wilayat Wuleswali Localitie s/Urban Areas Angola AGO Country Provinces /Provínci Municipio s Localitie s/Urban as Areas Anguilla Albania AIA ALB Country Parishes Country Qarqe/ Qark Communes/ Bashki Njësi/ Loc Andorra AND Country Parishes/ Parròquie s Localitie s/Urban Areas United Arab Emirates ARE Country Emirates Municipal ities Geospatial troubleshooting alities/ Urban Areas Cities/Lo calities/ Urban Areas 580 Amazon QuickSight User Guide Country name Country code Country State County City Argentina ARG Country Provinces Departame Comunas/ Armenia ARM Country /Provinci as ntos/ Depa Barrios rtments Provinces /Marzpet Localitie s/Urban Areas American Samoa ASM Country Districts Counties Villages Antarctica French Southern Territories ATA ATF Country Country Districts Antigua and Barbuda ATG Country Parishes Australia AUS Country States Localitie s/Urban Areas Local Governmen t Areas Suburbs/ Urban Centers Austria AUT Country Geospatial troubleshooting Districts/ Bezirke States/ Bu ndeslände r Municipal ities/ Gem einden/ Urban Areas/ Stadtteil 581 Amazon QuickSight User Guide Country name Country code Country State County City Azerbaijan AZE Country Burundi BDI Country Belgium BEL Country Regions/ Iqtisadi Rayonlar Districts/ Rayonlar Localitie s/Urban Areas Provinces Communes Localitie s/Urban Areas Regions/ Gewest Provinces /Provinci e Districts/ Arrondis sements/ M unicipali ties/ Comm unes Benin BEN Country Departmen ts Communes Localitie s/Urban Bonaire, Sint Eustasius, and Saba BES Country Municipal ities Areas Localitie s/Urban Areas Burkina Faso BFA Country Regions Provinces Communes/ Localitie s/Urban Areas Geospatial troubleshooting 582 Amazon QuickSight User Guide Country name Country code Country State County City Bangladesh BGD Country Divisions /Bibhag Districts/ Zila Bulgaria BGR Country Oblasts Obshtina Subdistri cts/Upzil a/Localit ies/ Urban Areas Localitie s/Urban Areas Bahrain Bahamas BHR BHS Bosnia and Herzegovi na BIH Country Governora tes Constitue ncies Localitie s Country Island Groups Districts Towns Country Kanton Federatio n/ Republi ka Saint Barthélemy BLM Country Belarus BLR Country Voblasts Rayon Opština/ L ocalities /Urban Areas Localitie s/Urban Areas Selsoviet /Localiti es/ Urban Areas Geospatial troubleshooting 583 Amazon QuickSight User Guide Country name Country code Country State County City Belize BLZ Country Districts Bermuda BMU Country Parishes Constitue ncies Localitie s/Urban Areas Localitie s/Urban Areas Bolivia BOL Country Provinces /Provinci Departame ntos/ Municipal ities/ Brazil BRA Country as Depa rtments Mun icipios/L ocalities /Urban Areas Provinces /States/ Municipal ities/ Localitie s/Urban U nidades Mun icipios Areas Barbados BRB Country Parishes Brunei BRN Country Bhutan BTN Country Districts/ Dawaïr Subdistri cts/ Mukim Districts/ Dzongkha g Localitie s/Urban Areas Villages/ Kampung/ L ocalities /Urban Areas Localitie s/Urban Areas Geospatial troubleshooting 584 Amazon QuickSight User Guide Country name Country code Country State County City Bouvet Island Botswana BVT BWA Country Country Districts Central African Republic CAF Country Regions Subdistri cts Localitie s/Urban Areas Prefectur es Sub Prefectur es/ Commun es Canada CAN Country Provinces /Territor Census Divisions Census Subdivisi ies ons/ Local ities/Urb an Areas Switzerland CHE Country
amazon-quicksight-user-163
amazon-quicksight-user.pdf
163
Provinces /States/ Municipal ities/ Localitie s/Urban U nidades Mun icipios Areas Barbados BRB Country Parishes Brunei BRN Country Bhutan BTN Country Districts/ Dawaïr Subdistri cts/ Mukim Districts/ Dzongkha g Localitie s/Urban Areas Villages/ Kampung/ L ocalities /Urban Areas Localitie s/Urban Areas Geospatial troubleshooting 584 Amazon QuickSight User Guide Country name Country code Country State County City Bouvet Island Botswana BVT BWA Country Country Districts Central African Republic CAF Country Regions Subdistri cts Localitie s/Urban Areas Prefectur es Sub Prefectur es/ Commun es Canada CAN Country Provinces /Territor Census Divisions Census Subdivisi ies ons/ Local ities/Urb an Areas Switzerland CHE Country Cantons/ Kanton/ District/ Bezirk/Di "Commune/ Gemeinde/ Can tone/ Chantun stretto/C Comune/ ircul Cumün/ Chile CHL Country Regions/ Regiones Province/ Provincia s Local ities/ Urban Areas" Communes/ Comunas/ L ocalities /Urban Areas Geospatial troubleshooting 585 Amazon QuickSight User Guide Country name Country code Country State County City China, People's Republic of CHN Country Provinces Prefectur es Cities/Co unties Cote d'Ivoire CIV Country Districts Regions Departmen ts/Sub Prefectur es Cameroon CMR Country Provinces /Regions Departmen ts Arrondiss ements/ Congo, Democratic Republic of COD Country Provinces Districts Congo, Republic of COG Country Departmen ts Cities Localitie s/Urban Areas Communes/ Arrondiss ements Cook Islands Colombia COK COL Country Island Councils Country Departmen tos Municipio s Localitie s/Urban Comoros COM Country Clipperton Island CPT Country Areas Villes/Vi llages Autonomou s Islands/ îles Autonomes Geospatial troubleshooting 586 Amazon QuickSight User Guide Country name Country code Country State County City Cape Verde CPV Country Ilhas Concelhos Localitie s/Urban Costa Rica CRI Country Provincia s Cantons Cuba CUB Country Provincia s Municipio s Curaçoa CUW Country Areas Distritos /Localiti es/ Urban Areas Localitie s/Urban Areas Localitie s/Urban Areas Cayman Islands CYM Country Districts Cyprus CYP Country Czech Republic CZE Country Districts/ Eparchie Municipal ities/Dim Localitie s/Urban s os Areas/ Sinikia Regions/ Kraj Municipal ities/Orp Obec/ Mesto Geospatial troubleshooting 587 Amazon QuickSight User Guide Country name Country code Country State County City Germany DEU Country Bundeslan d/States Kreis/Dis tricts Gemeinde/ Municipal Djibouti DJI Country Regions Dominica DMA Country Parishes ities/Sta dtteil/Lo calities/ Urban Areas Localitie s/Urban Areas Localitie s/Urban Areas Denmark DNK Country Regions Provinces Municipal ities/Loc Dominican Republic DOM Country Regions/ Regiones Provinces /Provinci as alities/ Urban Areas Municipal ities/ Mun icipios/L ocalities /Urban Areas Geospatial troubleshooting 588 Amazon QuickSight User Guide Country name Country code Country State County City Algeria DZA Country Provinces /Wilayas Districts Ecuador ECU Country Provinces Cantons Municipal ities/Bal adiyas/ Lo calities/ Urban Areas Parishes/ Localitie s/Urban Areas Egypt EGY Country Eritrea ERI Country Spain ESP Country Governora tes/ Municipal Divisions Towns/ Cities/ Muhaf /Markaz Sub azat Municipal Divisions Regions/ Zoba Districts/ Subzobas Localitie s/Urban Areas Municipio s/Localit ies/ Urban Areas Autonomou Provincia s s Communiti es/ Comuni dados Autonomas Geospatial troubleshooting 589 Amazon QuickSight User Guide Country name Country code Country State County City Estonia EST Country Maakond Omavalits us/Linn/ Vald Ethiopia ETH Country Regions/ Kililoch Zones/ Zonouch Küla/ Loca lities/ Urban Areas Localitie s/Urban Areas Finland FIN Country Regions/ M Sub- Regions/ Municipal ities/Kun aakunta Seutuk ta/Locali unta ties/ Urban Areas Fiji Falkland Islands France FJI FLK FRA Country Divisions Provinces Districts/ Villages Country Country Regions Départeme nts Arrondiss ements/ Cantons Faroe Islands FRO Country Regions/ Syslur Municipal ities/ Kom munur Localitie s/Urban Areas Geospatial troubleshooting 590 Amazon QuickSight User Guide Country name Country code Country State County City Federated States of Micronesia Gabon FSM GAB Country States Country Provinces Departmen ts Localitie s/Urban United Kingdom GBR Country Nations Counties Areas Districts /Localiti es/ Urban Areas Georgia GEO Country Regions/ Mkhare Municipal ities/ Localitie s/Urban Areas Mun itsipalit eti Ghana GHA Country Regions Districts Gibraltar GIB Country Localitie s/Urban Areas Localitie s/Urban Areas Geospatial troubleshooting 591 Amazon QuickSight User Guide Country name Country code Country State County City Guinea GIN Country Regions Prefectur es Sub Prefectur es/Locali ties/ Urban Areas Guadeloupe GLP Country Arrondiss ements Communes Localitie s/Urban Gambia GMB Country Regions Districts Guinea Bissau GNB Country Regions Sectors Areas Localitie s/Urban Areas Localitie s/Urban Areas Equatorial Guinea GNQ Country Regions Provincia s Distritos /Localiti Greece GRC Country Regions/ P eriphenie s Regional Units Peri Enotities Geospatial troubleshooting es/ Urban Areas Municipal ities/ Domoi/ Locali ties/ Urban Areas 592 Amazon QuickSight User Guide Country name Country code Country State County City Grenada GRD Country States Parishes/ Dependenc Localitie s/Urban ies Areas Greenland GRL Country Guatemala GTM Country French Guiana GUF Country Municipal ities/ Kom munia Departmen ts/ Municipal ities/ Localitie s/Urban Depart Mun Areas amentos icipios Arrondiss ements Communes Localitie s/Urban Areas Guam Country = USA States Districts Guyana GUY Country Regions Hong Kong HKG Country Districts Neighborh ood Councils Localitie s/Urban Areas Subdistri cts Localitie s/Urban Areas Heard and McDonald Islands HMD Country Geospatial troubleshooting 593 Amazon QuickSight User Guide Country name Country code Country State County City Honduras HND Country
amazon-quicksight-user-164
amazon-quicksight-user.pdf
164
Guide Country name Country code Country State County City Grenada GRD Country States Parishes/ Dependenc Localitie s/Urban ies Areas Greenland GRL Country Guatemala GTM Country French Guiana GUF Country Municipal ities/ Kom munia Departmen ts/ Municipal ities/ Localitie s/Urban Depart Mun Areas amentos icipios Arrondiss ements Communes Localitie s/Urban Areas Guam Country = USA States Districts Guyana GUY Country Regions Hong Kong HKG Country Districts Neighborh ood Councils Localitie s/Urban Areas Subdistri cts Localitie s/Urban Areas Heard and McDonald Islands HMD Country Geospatial troubleshooting 593 Amazon QuickSight User Guide Country name Country code Country State County City Honduras HND Country Departmen ts/ Municipal ities/ Localitie s/Urban Depart Mun Areas amentos icipios Croatia HRV Country Counties Municipal ities Localitie s/Urban Areas Haiti HTI Country Departmen ts/ Districts/ Arrondis Communes/ Localitie Hungary Indonesia HUN IDN Départ ements sements Country Regiok Megyék s/Urban Areas Járások/ Városok Country Provinces /Provinsi Regency/ K Districts/ Kecamata abupaten n/Localit India IND Country Districts States/ Te rritories British Indian Ocean Territory IOT Country ies/ Urban Areas Subdistri cts/ Towns/ Localiti es/ Urban Areas Geospatial troubleshooting 594 Amazon QuickSight User Guide Country name Country code Country State County City Ireland IRL Country Regions Counties Electoral Divisions /Localiti es/ Urban Areas Iran IRN Country Iraq IRQ Country Provinces / Counties/ Shahresta Localitie s/ Ostanha n Dehestâ Governora tes/ Districts /Qadaa/ Muhaf Kaza azat n Urban Areas/ Loc alities Iceland Israel Italy ISL ISR ITA Country Regions/ L Municipal ities/Sve Localitie s/Urban andsvaedi itarfelog Areas Country Districts Cities/ Local Localitie s/Urban Councils Areas Country Regiones Provincia s Jamaica JAM Country Counties Parishes Geospatial troubleshooting Communes/ Localitie s/Urban Areas Constitue ncies/ Loc alities/ Urban Areas 595 Amazon QuickSight User Guide Country name Country code Country State County City Jordan Japan JOR JPN Country Governora tes Districts Country Prefectur es Kazakhstan KAZ Country Regions/ Oblystar Districts/ Audandar Subdistri cts/Citie s Cities/Di stricts/M unicipali ties Towns/ Kent/ Localit ies/ Urban Areas Kenya KEN Country Counties Constitue ncies Localitie s/Urban Areas/ Suburbs Kyrgyzstan KGZ Country Regions/ O blasttar Districts/ Raions Localitie s/Urban Areas Cambodia KHM Country Provinces /Khaet Districts/ Srŏk Communes/ Khum/ Loca lities/ Urban Areas Kiribati KIR Country Districts Island Councils Geospatial troubleshooting 596 Amazon QuickSight User Guide Country name Country code Country State County City Saint Kitts and Nevis KNA Country Parishes States Localitie s/Urban Areas South Korea KOR Country Provinces /Do Districts/ Si/Gun Localitie s/Urban Kuwait KWT Country Laos LAO Country Lebanon LBN Country Areas Cities/Co mmunities Governora tes/ Muhaf Areas/ Min taqah azah Provinces / Districts/ Muang Localitie s/Urban Khoueng Areas Governora tes/ Districts/ Qadaa Municipal ities/Loc Muhaf azat Liberia LBR Country Counties Districts alities/ Urban Areas Clans/ Loc alities/ Urban Areas Geospatial troubleshooting 597 Amazon QuickSight User Guide Country name Country code Country State County City Libya LBY Country Saint Lucia LCA Country Liechtenstein LIE Country Districts/ Shabiya Districts/ Quarters Cities/Lo calities/ Urban Areas Localitie s/Urban Areas Districts/ Bezirk Municipal ities/ Localitie s/Urban Gem einden Areas Sri Lanka LKA Country Provinces Districts Divisiona l Secretari ats/Local ities/Urb an Areas Lesotho LSO Country Districts Lithuania LTU Country Apskritis Constitue ncies Community Councils/ Localitie s Savivaldy bé Seniūnija Geospatial troubleshooting 598 Amazon QuickSight User Guide Country name Country code Country State County City Luxembourg LUX Country Cantons/ K Communes/ Gemengen/ Localitie s/ antounen/ Gemeinden Ortscha Kantone ft/Uertsc haft/Citi es Latvia LVA Country Regions Municipal ities/Nov Pilsētas/ Pagasti/ adi L Macao Saint Martin MAC MAF Country Parishes Districts Country ocalities /Urban Areas Localitie s/Urban Areas Morocco MAR Country Regions Provinces / Communes/ Localitie Prefectu res s/Urban Areas Monaco MCO Country Communes Wards/ Qua rtiers Geospatial troubleshooting 599 Amazon QuickSight User Guide Country name Country code Country State County City Moldova MDA Country Raion Comuna Madagascar MDG Country Regions/ Faritra Districts Localitie s/Urban Areas Communes/ Localitie s/Urban Areas Maldives MDV Country Atolls/Ci ties Islands Mexico MEX Country Estados Marshall Islands MHL Country Macedonia MKD Country Municipal ities Statistic al Regions Mali MLI Country Regions Municipio s/ Colonias/ Localitie Delegac s/Urban iones Areas Opstina Localitie s/Urban Areas Communes Localitie s/Urban Areas Geospatial troubleshooting 600 Amazon QuickSight User Guide Country name Country code Country State County City Malta MLT Country Districts Myanmar MMR Country Montenegro MNE Country States/ Regions/ Union Territori es Opštine/ M unicipali ties Mongolia MNG Country Regions Local Councils/ Localitie s/Urban Kunsilli Areas Lokali Districts Townships /Localiti es/ Urban Areas Localitie s/Urban Areas Provinces /Aimags Districts /Sums/ Loc alities/ Urban Areas Northern Mariana Islands MNP Country Municipal ities Mozambique MOZ Country Provinces Districts/ Distritos Localitie s/Urban Areas Geospatial troubleshooting 601 Amazon QuickSight User Guide Country name Country code Country State County City Mauritania MRT Country Regions Départeme nts Localitie s/Urban Areas Montserrat MSR Country Parishes Regions Localitie s/Urban Areas Martinique MTQ Country Arrondiss ements Communes Localitie s/Urban Areas Mauritius MUS Country Islands Districts Wards/ Malawi MWI Country Regions Districts Malaysia MYS Country States/
amazon-quicksight-user-165
amazon-quicksight-user.pdf
165
Mongolia MNG Country Regions Local Councils/ Localitie s/Urban Kunsilli Areas Lokali Districts Townships /Localiti es/ Urban Areas Localitie s/Urban Areas Provinces /Aimags Districts /Sums/ Loc alities/ Urban Areas Northern Mariana Islands MNP Country Municipal ities Mozambique MOZ Country Provinces Districts/ Distritos Localitie s/Urban Areas Geospatial troubleshooting 601 Amazon QuickSight User Guide Country name Country code Country State County City Mauritania MRT Country Regions Départeme nts Localitie s/Urban Areas Montserrat MSR Country Parishes Regions Localitie s/Urban Areas Martinique MTQ Country Arrondiss ements Communes Localitie s/Urban Areas Mauritius MUS Country Islands Districts Wards/ Malawi MWI Country Regions Districts Malaysia MYS Country States/ Negeri Districts/ Daïra/Da erah Loc alities/ Urban Areas Localitie s/Urban Areas Subdistri cts/ Mukim/ Localiti es/ Urban Area/ Baha gian Kecil Geospatial troubleshooting 602 Amazon QuickSight User Guide Country name Country code Country State County City Mayotte Namibia New Caledonia Niger MYT NAM NCL NER Country Communes Villages Country Provinces Constitue ncies Suburbs/ L ocalities Country Provinces Communes Country Regions Departmen ts Localitie s/Urban Areas Local Governmen Towns/ Cities t Areas Nigeria NGA Country States Nicaragua NIC Country Departmen ts/ Municipal ities/ Localitie s/Urban Depart Mun Areas amentos icipios Niue Netherlands NIU NLD Country Villages Towns Country Counties/ Fylker Districts/ Okonomis k Municipal ities, Kommuner, Localitie s, or Urban Areas Geospatial troubleshooting 603 Amazon QuickSight User Guide Country name Country code Country State County City Norway NOR Country Counties/ Fylker Districts/ Okonomis Municipal ities, Nepal NPL Country k Kommuner, Localitie s, or Urban Areas Provinces / Districts/ Jilla Municipal ities/Loc Pradesha haru alities/ Urban Areas Nauru New Zealand NRU NZL Country Districts Country Regions Territori al Statistic al Areas/ Authoriti Loc Oman OMN Country es Provinces /Wilayat Governora tes/ Muhaf azah Pakistan PAK Country Provinces Districts alities/ Urban Areas Cities/ Urban Areas/ Com munities Localitie s/Tehsils Geospatial troubleshooting 604 Amazon QuickSight User Guide Country name Country code Country State County City Panama PAN Country Provinces /Provinci Districts/ Distrito Corregimi entos/ as Pitcairn Islands Peru PCN PER Country Islands Country Regions Districts Loc alities/ Urban Areas Distritos /Localiti es/ Urban Areas Philippines PHL Country Regions/ Rehiyon Provinces / Municipal ities/ Lalawiga Mun n isipiyos/ Cities/Lu ngsod Palau Papua New Guinea PLW PNG Country States Country Regions Provinces Districts /Localiti es/ Urban Areas Poland POL Country Counties/ Powiats Provinces / Voivodes hips Communes/ Gminas/ Towns/ Dziel nicas Geospatial troubleshooting 605 Amazon QuickSight User Guide Country name Country code Country State County City North Korea PRK Country Provinces Localitie s/Urban Areas Portugal PRT Country Districts/ Distritos Municipal ities/Con Civil Parish/Fr celhos eguesias/ Paraguay PRY Country Departmen ts Distritos Localitie s/Urban Areas Localitie s/Urban Areas Palestine PSE Country French Polynesia PYF Country Qatar QAT Country Réunion REU Country Romania ROU Country Territori es Governora tes/ Localitie s/Urban Muhaf Areas azat Communes Zones Localitie s/Urban Areas Communes Localitie s/Urban Areas Subdivisi ons/Iles Municipal ities/Bal adiyat Arrondiss ements Regions/ Judete Communes Towns/ Oraș Geospatial troubleshooting 606 Amazon QuickSight User Guide Country name Country code Country State County City Russia RUS Country Oblast' Federal District/ Federal'n yy Okrug Rwanda RWA Country Provinces Districts Rayon/ Raion/ Urban Area/ Gorod Sectors/ S ecteurs/ L ocalities /Urban Areas Saudi Arabia SAU Country Sudan SDN Country Regions/ Manatiq Governora tes/ Municipal ities/ Muhaf Amanah azat States/ Wilaya'at Localitie s/Urban Areas Senegal SEN Country Regions Departmen ts Arrondiss ements/ Lo calities/ Urban Areas Singapore Saint Helena SGP SHN Geospatial troubleshooting Country Districts Constitue ncies Wards Country Islands Districts Localitie s/Urban Areas 607 Amazon QuickSight User Guide Country name Country code Country State County City Solomon Islands SLB Country Provinces Constitue Wards ncies Sierra Leone SLE Country Provinces Districts Chiefdoms /Localiti es/ Urban Areas El Salvador SLV Country San Marino SMR Country Somalia SOM Country Departmen ts/ Municipal ities/ Localitie s/Urban Depart Mun Areas amentos icipios Municipal ities/Cas Localitie s/Urban telli Areas Regions/ G obolada Localitie s/Urban Areas Saint Pierre and Miquelon Serbia SPM SRB Country Communes Country Autonomna Pokrajina /Regions Okrug/ Districts Geospatial troubleshooting Opstina/ M unicipali ties/Loca lities/ Urban Areas 608 Amazon QuickSight User Guide Country name Country code Country State County City South Sudan SSD Country States/ Wilayat Counties São Tomé and Príncipe STP Country Provinces Districts Suriname SUR Country Districts/ Distrikt Resorts Localitie s/Urban Areas Localitie s/Urban Areas Localitie s/Urban Areas Slovakia SVK Country Regions/ Kraje Districts/ Okresy Municipal ities/ Obec/ Mestská cast Slovenia SVN Country Regions/ Regi Upravne Enote Municipal ities/ Sweden SWE Country Counties Municipal Eswatini SWZ Country Regions ities Tinkhundl a Obcine/ Local ities/Urb an Areas Localitie s/Urban Areas Towns/ Suburbs/ Loca lities Geospatial troubleshooting 609 Amazon QuickSight User Guide Country name Country code Country State County City Sint Maarten SXM Country Settlemen ts Seychelles SYC Country Districts Localitie s/Urban Areas Syria SYR Country Governora tes Districts/ Muhafaza Cities/Lo calities/ h Urban Areas Turks and Caicos Islands Chad TCA TCD Country Districts Localitie s Country Regions
amazon-quicksight-user-166
amazon-quicksight-user.pdf
166
s/Urban Areas Slovakia SVK Country Regions/ Kraje Districts/ Okresy Municipal ities/ Obec/ Mestská cast Slovenia SVN Country Regions/ Regi Upravne Enote Municipal ities/ Sweden SWE Country Counties Municipal Eswatini SWZ Country Regions ities Tinkhundl a Obcine/ Local ities/Urb an Areas Localitie s/Urban Areas Towns/ Suburbs/ Loca lities Geospatial troubleshooting 609 Amazon QuickSight User Guide Country name Country code Country State County City Sint Maarten SXM Country Settlemen ts Seychelles SYC Country Districts Localitie s/Urban Areas Syria SYR Country Governora tes Districts/ Muhafaza Cities/Lo calities/ h Urban Areas Turks and Caicos Islands Chad TCA TCD Country Districts Localitie s Country Regions Départeme nts Arrondiss ements/ Togo TGO Country Thailand THA Country Regions/ P rovinces Provinces / Changwat Lo calities/ Urban Areas Prefectur es Localitie s/Urban Districts/ Amphoe Areas Subdistri cts/ Tambo n/Localit ies/ Urban Areas Geospatial troubleshooting 610 Amazon QuickSight User Guide Country name Country code Country State County City Tajikistan TJK Country Provinces /Regions Districts/ Raion/Ra Localitie s/Urban yon Areas Tokelau Turkmenistan East Timor (Timor-Le ste) TKL TKM TLS Country Atolls Country Provinces /Welayat Districts/ Etraplar Towns Country Municipal ities Administr ative Localitie s/Urban Post Areas Tonga TON Country Trinidad and Tobago TTO Country Tunisia TUN Country Subdivisi ons Municipal ities Localitie s/Urban Areas Governate s/ Delegatio ns/ Municipal ities/Sha Wilayahs Mutama ykhats/ diyats Lo calities/ Urban Areas Geospatial troubleshooting 611 Amazon QuickSight User Guide Country name Country code Country State County City Turkey TUR Country Provinces /Il Districts/ Ilce Tuvalu Taiwan TUV TWN Country Islands Country Provinces Counties Urban Areas/ Belde/ Subdis tricts/ Bucak/ Neigh borhoods/ Mahalle Townships /Local Neighborh oods Tanzania TZA Country Provinces /Mkoa Districts/ Wilaya Localitie s/Urban Uganda UGA Country Regions Districts Areas Counties/ Localitie s/Urban Areas Geospatial troubleshooting 612 Amazon QuickSight User Guide Country name Country code Country State County City Ukraine UKR Country Raions Oblast/ Mista/ Avton omna Respublik a Settlemen t Councils/ Rural Councils/ Localitie s/Urban Areas United States Minor Outlying Islands Uruguay UMI URY Country Islands/ Atolls Country Departmen ts/ Municipio s/ Segmentos /Localiti Depart Municip es/ amentos alities/S Urban ecciones Areas United States of America USA Country States/ Te rritories Counties MCD/ CCD/ Post Localitie s/ Municip alities Localitie s/Urban Areas Uzbekistan UZB Country Regions/ V iloyatlar Districts/ Tumanlar Geospatial troubleshooting 613 Amazon QuickSight User Guide Country name Country code Country State County City Vatican City VAT Country Saint Vincent and the Grenadines VCT Country Parishes Divisions Localitie s/Urban Areas Localitie s/Urban Areas Venezuela VEN Country States/ Estados Municipal ities/ Mun Localitie s/Urban Areas/ icipios Parish/ Parro quias British Virgin Islands VGB Country Districts Vietnam VNM Country Provinces /Cities Districts Wards/ Loc alities/ Urban Areas Vanuatu Wallis and Futuna Islands VUT WLF Country Provinces Country Districts/ Rayaumes Samoa WSM Country Districts/ Itūmālō Towns Geospatial troubleshooting Localitie s/Urban Areas 614 Amazon QuickSight User Guide Country name Country code Country State County City Kosovo XKS Country Districts Municipal ities Localitie s/Urban Areas Yemen YEM Country Governora tes/ Districts/ Muderiah Localitie s/Urban South Africa ZAF Country Provinces Districts Muhaf azat Zambia ZMB Country Provinces Districts Areas Municipal ities/War ds Suburbs/ L ocalities Zimbabwe ZWE Country Provinces Districts/ Muderiah Localitie s/Urban Areas The following is a list of the supported postal code formats by country, including the number of digits and an example postal code. Note PO BOX zipcodes are not supported postal code formats. Union territory zip codes that are used in India are also not supported. Geospatial troubleshooting 615 Amazon QuickSight Supported postal codes User Guide Country Postal format Example Afghanistan Albania Algeria American Samoa Andorra Anguilla Argentina Armenia Australia Austria Azerbaijan Brunei Darussalam Bahrain Bangladesh 4 digit 4 digit 5 digit 5 digit 5 digit 6 digit 5 digit 2 digit 4 digit 4 digit 2 digit 6 digit 4 digit 2 digit 1001 1001 01000 96799 AD100 AI-2640 A4126 00 0800 1010 01 BA1111 0101 10 Geospatial troubleshooting 616 Amazon QuickSight User Guide Country Belarus Belgium Bermuda Bhutan Bosnia and Herzegovina Brazil Postal format 6 digit 4 digit 4 digit 2 digit 5 digit 5 digit Example 202115 1000 CR 01 11 70101 01001 British Indian Ocean Territory Alphanumeric ‐ 5 digit BBND 1 British Virgin Islands Bulgaria Cabo Verde Cambodia Canada 4 digit 4 digit 4 digit 2 digit 3 digit 1110 1000 1101 01 A0A Cayman Islands Alphanumeric - 7 digit KY1-1000 Chile China 3 digit 4 digit 100 0100 Geospatial troubleshooting 617 Postal format Example User Guide Amazon QuickSight Country Colombia Costa Rica Croatia Cuba Cyprus Czechia 4 digit 5 digit 5 digit 1 digit 4 digit 5 digit Democratic Republic of the Congo 4 digit Denmark Dominican Republic Ecuador Egypt El Salvador Estonia 4 digit 5 digit 6 digit 2 digit 4 digit 5 digit 0500 10101 10000 1 1010 100 00 1001 1050 10101 010101 11 1101 10001 Falkland Islands Alphanumeric - 5 digit FIQQ 1
amazon-quicksight-user-167
amazon-quicksight-user.pdf
167
digit 1110 1000 1101 01 A0A Cayman Islands Alphanumeric - 7 digit KY1-1000 Chile China 3 digit 4 digit 100 0100 Geospatial troubleshooting 617 Postal format Example User Guide Amazon QuickSight Country Colombia Costa Rica Croatia Cuba Cyprus Czechia 4 digit 5 digit 5 digit 1 digit 4 digit 5 digit Democratic Republic of the Congo 4 digit Denmark Dominican Republic Ecuador Egypt El Salvador Estonia 4 digit 5 digit 6 digit 2 digit 4 digit 5 digit 0500 10101 10000 1 1010 100 00 1001 1050 10101 010101 11 1101 10001 Falkland Islands Alphanumeric - 5 digit FIQQ 1 Geospatial troubleshooting 618 Amazon QuickSight Country Faroe Islands Finland France French Guiana French Polynesia Georgia Germany Ghana Gibraltar Greece Greenland Guadeloupe Guam Guatemala Postal format Example User Guide 3 digit 5 digit 5 digit 5 digit 5 digit 2 digit 5 digit 2 digit 100 00100 01000 97300 98701 01 01067 A2 Alphanumeric - 5 digit GX11 1 5 digit 4 digit 5 digit 5 digit 5 digit 104 31 3900 97100 96910 01001 Geospatial troubleshooting 619 Amazon QuickSight Country Guernsey Guinea-Bissau Haiti Holy See Honduras Hungary Iceland India Indonesia Iran Iraq Ireland Postal format Example User Guide Alphanumeric - 4 digit, 5 digit GY1 1, GY10 1 4 digit 4 digit 5 digit 2 digit 4 digit 3 digit 6 digit 5 digit 2 digit 2 digit 3 digit 1000 1110 00120 11 1007 101 110001 10110 11 10 A41 Isle of Man Alphanumeric - 4 digit IM1 1 Israel 5 digit 10292 Geospatial troubleshooting 620 Amazon QuickSight Country Italy Japan Jersey Jordan Kazakhstan Kenya Kiribati Kosovo Kuwait Kyrgyzstan Laos Latvia Lesotho Liberia Postal format Example User Guide 5 digit 7 digit 00010 001-0010 Alphanumeric - 4 digit JE2 3 5 digit 4 digit 1 digit 6 digit 5 digit 2 digit 4 digit 2 digit 4 digit 1 digit 2 digit 11100 0100 0 KI0101 10000 00 7200 01 1001 1 10 Geospatial troubleshooting 621 Amazon QuickSight Country Liechtenstein Lithuania Luxembourg Macedonia Madagascar Malawi Malaysia Maldives Malta Marshall Islands Martinique Mauritius Mayotte Mexico Postal format Example User Guide 4 digit 5 digit 4 digit 4 digit 3 digit 3 digit 5 digit 2 digit 3 digit 3 digit 5 digit 3 digit 5 digit 5 digit 9485 00100 1110 1000 101 101 01000 00 ATD 969 97200 111 97600 01000 Geospatial troubleshooting 622 Amazon QuickSight Country Micronesia Moldova Monaco Mongolia Montenegro Montserrat Morocco Mozambique Myanmar Namibia Nepal Netherlands New Caledonia New Zealand Postal format Example User Guide 5 digit 4 digit 5 digit 4 digit 5 digit 4 digit 5 digit 4 digit 2 digit 3 digit 3 digit 4 digit 5 digit 4 digit 96941 2001 98000 1200 81000 1120 10000 1100 01 100 101 1011 98800 0110 Geospatial troubleshooting 623 Amazon QuickSight Country Nicaragua Niger Nigeria Niue Norfolk Island Northern Mariana Islands Norway Oman Pakistan Palau Palestine Papua New Guinea Paraguay Peru Postal format Example User Guide 3 digit 4 digit 4 digit 4 digit 4 digit 5 digit 4 digit 1 digit 2 digit 5 digit 4 digit 3 digit 6 digit 5 digit 110 1000 1002 9974 2899 96950 0010 1 10 96939 P104 111 001001 01000 Geospatial troubleshooting 624 Amazon QuickSight Country Postal format Example User Guide Philippines 4 digit 1000 Pitcairn Poland Portugal Puerto Rico Romania Russia Réunion Saint Barthélemy Alphanumeric - 5 digit PCRN 1 5 digit 4 digit 5 digit 6 digit 6 digit 5 digit 5 digit 00-002 1000 00601 010011 101000 97400 97133 Saint Helena, Ascension and Tristan da Cunha Alphanumeric - 5 digit ASCN 1 Saint Lucia Saint Martin 7 digit 5 digit Saint Pierre and Miquelon 5 digit Saint Vincent and the Grenadines 4 digit LC01 101 97150 97500 VC01 Geospatial troubleshooting 625 Amazon QuickSight Country Samoa San Marino Saudi Arabia Senegal Serbia Singapore Slovakia Slovenia South Africa Postal format Example User Guide 2 digit 5 digit 2 digit 5 digit 5 digit 6 digit 5 digit 4 digit 4 digit 11 47890 12 10000 11000 018906 010 01 1000 0001 South Georgia and the South Sandwich Islands Alphanumeric - 5 digit SIQQ 1 South Korea Spain Sri Lanka Sudan 5 digit 5 digit 2 digit 2 digit 01000 01001 00 11 Geospatial troubleshooting 626 Postal format Example User Guide Amazon QuickSight Country Svalbard and Jan Mayen Swaziland Sweden Switzerland Taiwan Tajikistan 4 digit 1 digit 5 digit 4 digit 3 digit 4 digit Tanzania, United Republic of 3 digit Thailand Timor-Leste Trinidad and Tobago Tunisia Turkey Turkmenistan 5 digit 4 digit 2 digit 4 digit 5 digit 3 digit 8099 H 111 15 1000 100 7340 111 10100 TL10 10 1000 01010 744 Turks and Caicos Islands Alphanumeric - 5 digit TKCA 1 Geospatial troubleshooting 627 Amazon QuickSight Country Postal format Example User Guide U.S.
amazon-quicksight-user-168
amazon-quicksight-user.pdf
168
2 digit 01000 01001 00 11 Geospatial troubleshooting 626 Postal format Example User Guide Amazon QuickSight Country Svalbard and Jan Mayen Swaziland Sweden Switzerland Taiwan Tajikistan 4 digit 1 digit 5 digit 4 digit 3 digit 4 digit Tanzania, United Republic of 3 digit Thailand Timor-Leste Trinidad and Tobago Tunisia Turkey Turkmenistan 5 digit 4 digit 2 digit 4 digit 5 digit 3 digit 8099 H 111 15 1000 100 7340 111 10100 TL10 10 1000 01010 744 Turks and Caicos Islands Alphanumeric - 5 digit TKCA 1 Geospatial troubleshooting 627 Amazon QuickSight Country Postal format Example User Guide U.S. Virgin Islands 5 digit 00802 Ukraine 3 digit, 5 digit 070, 01001 United Kingdom Alphanumeric - 2 to 5 digits B1, AL1, AB10, AB10 1 United States Uruguay Uzbekistan Venezuela Vietnam Wallis and Futuna Zambia 5 digit 5 digit 4 digit 4 digit 5 digit 5 digit 5 digit 00001 11000 1000 0000 01106 98600 10100 Using unsupported or custom dates Amazon QuickSight natively supports a limited number of date formats. However, you can’t always control the format of the data provided to you. When your data contains a date in an unsupported format, you can tell Amazon QuickSight how to interpret it. You can do this by editing the dataset, and changing the format of the column from text or numeric to date. A screen appears after you make this change, so you can enter the format. For example, if you are using a relational data source, you can specify MM-dd-yyyy for a text field Using unsupported or custom dates 628 Amazon QuickSight User Guide containing '09-19-2017', so it is interpreted as 2017-09-19T00:00:00.000Z. If you are using a nonrelational data source, you can do the same thing starting with a numeric field or a text field. Amazon QuickSight only supports text to date for relational (SQL) sources. For more information on supported date formats, see Supported date formats. Use this procedure to help Amazon QuickSight understand dates in different formats. 1. For a dataset containing unsupported date formats, edit the data as follows. For the column containing your datetime data, change the data type from text to date. Do this by choosing the colorful data type icon beneath the column name in the data preview. Note Integer dates that aren’t Unix epoch datetimes don't work as is. For example, these formats are not supported as integers: MMddyy, MMddyyyy, ddMMyy, ddMMyyyy, and Using unsupported or custom dates 629 Amazon QuickSight User Guide yyMMdd. The workaround is to first change them to text format. Make sure all your rows contain six digits (not five). Then change the text data type to datetime. For more information on Unix epoch datetimes, see epochDate. When you change the data type to date, the Edit date format screen appears. 2. Enter your date format, indicating which parts are month, date, year, or time. Formats are case-sensitive. 3. Choose Validate to make sure Amazon QuickSight can now interpret your datetime data with the format you specified. Rows that don't validate are skipped and omitted from the dataset. 4. When you are satisfied with the results, choose Update. Otherwise, choose Close. Adding a unique key to an Amazon QuickSight dataset QuickSight authors can configure a unique key column to a QuickSight dataset during data preparation. This unique key acts as a global sorting key for the dataset and optimizes query generation for table visuals. When a user creates a table visual in QuickSight and adds the unique key column to the value field well,data is sorted from left to right up to the unique key column. All columns to the right of the unique key column are ignored in the sort order. Tables that don't contain a unique key are sorted based on the order that the columns appar in the dataset. The following limitations apply to unique keys: • Unique keys are only supported for unaggregated tables. • If a dataset column is used for column level security (CLS), the column can't also be used as the unique key. Use the following procedure to designate a unique key for a dataset in Amazon QuickSight. To set up a unique key 1. Open the QuickSight console. 2. Choose Datasets. 3. Perform one of the following actions: Adding a unique key to a QuickSight dataset 630 Amazon QuickSight User Guide a. Navigate to the dataset that you want to add a unique key to, choose the ellpisis (three dots) next to the dataset, and then choose Edit. b. Choose New dataset, choose the dataset that you want to add, and then choose Edit data source. For more information about creating new datasets in Amazon QuickSight, see Creating datasets. 4. The data preparation page for the dataset opens. Navigate to the Fields pane and locate the field that you
amazon-quicksight-user-169
amazon-quicksight-user.pdf
169
Choose Datasets. 3. Perform one of the following actions: Adding a unique key to a QuickSight dataset 630 Amazon QuickSight User Guide a. Navigate to the dataset that you want to add a unique key to, choose the ellpisis (three dots) next to the dataset, and then choose Edit. b. Choose New dataset, choose the dataset that you want to add, and then choose Edit data source. For more information about creating new datasets in Amazon QuickSight, see Creating datasets. 4. The data preparation page for the dataset opens. Navigate to the Fields pane and locate the field that you want to set as the unique key. 5. Choose the ellipsis (three dots) next to the field name, and then choose Set as unique key. After you create a unique key, a key icon appears next to the field to show that the field is now the unique key for the dataset. When you save and publish the dataset, the unique key configuration is applied to the dataset and to all dashboards and analyses that are created with that dataset. To remove a unique key from a dataset, navigate to the data preparation page for the dataset, choose the ellipsis next to the unique key field, and then choose Remove as unique key. After you remove a unique key from a dataset, you can designate a different field as the unique key. Integrating Amazon SageMaker AI models with Amazon QuickSight Note You don't need any technical experience in machine learning (ML) to author analyses and dashboards that use the ML-powered features in Amazon QuickSight. You can augment your Amazon QuickSight Enterprise edition data with Amazon SageMaker AI machine learning models. You can run inferences on data stored in SPICE imported from any data source supported by Amazon QuickSight. For a full list of supported data sources, see Supported data sources. Using Amazon QuickSight with SageMaker AI models can save the time that you might otherwise spend managing data movement and writing code. The results are useful both for evaluating the model and—when you're satisfied with the results—for sharing with decision-makers. You can begin immediately after the model is built. Doing this surfaces your data scientists' prebuilt models, and enables you to apply the data science to your datasets. Then you can share these Integrating SageMaker AI models 631 Amazon QuickSight User Guide insights in your predictive dashboards. With the Amazon QuickSight serverless approach, the process scales seamlessly, so you don't need to worry about inference or query capacity. Amazon QuickSight supports SageMaker AI models that use regression and classification algorithms. You can apply this feature to get predictions for just about any business use case. Some examples include predicting the likelihood of customer churn, employee attrition, scoring sales leads, and assessing credit risks. To use Amazon QuickSight to provide predictions, the SageMaker AI model data for both input and output must be in tabular format. In multiclass or multilabel classification use cases, each output column has to contain a single value. Amazon QuickSight doesn’t support multiple values inside a single column. Topics • How SageMaker AI integration works • Costs incurred (no additional costs with integration itself) • Usage guidelines • Defining the schema file • Adding a SageMaker AI model to your QuickSight dataset • Build predictive models with SageMaker AI Canvas How SageMaker AI integration works In general, the process works like this: 1. An Amazon QuickSight administrator adds permissions for Amazon QuickSight to access SageMaker AI. To do this, open Security & Permissions settings from the Manage QuickSight page. Go to QuickSight access to AWS services, and add SageMaker AI. When you add these permissions, Amazon QuickSight is added to an AWS Identity and Access Management (IAM) role that provides access to list all the SageMaker AI models in your AWS account. It also provides permissions to run SageMaker AI jobs that have names that are prefixed with quicksight-auto-generated-. 2. We recommend that you connect to an SageMaker AI model that has an inference pipeline, because it automatically performs data preprocessing. For more information, see Deploy an Inference Pipeline in the SageMaker AI Developer Guide. 3. After you identify the data and the pretrained model that you want to use together, the owner of the model creates and provides a schema file. This JSON file is a contract with SageMaker AI. How SageMaker AI integration works 632 Amazon QuickSight User Guide It provides metadata about the fields, data types, column order, output, and settings that the model expects. The optional settings component provides the instance size and count of the compute instances to use for the job. If you're the data scientist who built the model, create this schema file using the format documented following. If you're a consumer of the model, get the schema file from
amazon-quicksight-user-170
amazon-quicksight-user.pdf
170
want to use together, the owner of the model creates and provides a schema file. This JSON file is a contract with SageMaker AI. How SageMaker AI integration works 632 Amazon QuickSight User Guide It provides metadata about the fields, data types, column order, output, and settings that the model expects. The optional settings component provides the instance size and count of the compute instances to use for the job. If you're the data scientist who built the model, create this schema file using the format documented following. If you're a consumer of the model, get the schema file from the owner of the model. 4. In Amazon QuickSight, you begin by creating a new dataset with the data that you want to make predictions on. If you're uploading a file, you can add the SageMaker AI model on the upload settings screen. Otherwise, add the model on the data preparation page. Before you proceed, verify the mappings between the dataset and the model. 5. After the data is imported into the dataset, the output fields contain the data returned from SageMaker AI. You use these fields just as you use other fields, within the guidelines described in Usage guidelines. When you run SageMaker AI integration, Amazon QuickSight passes a request to SageMaker AI to run batch transform jobs with inference pipelines. Amazon QuickSight starts provisions and deployment of the instances needed in your AWS account. When processing is complete, these instances are shut down and terminated. The compute capacity incurs costs only when it's processing models. To make it easier for you to identify them, Amazon QuickSight names all its SageMaker AI jobs with the prefix quicksight-auto-generated-. 6. The output of the inference is stored in SPICE and appended to the dataset. As soon as the inference is complete, you can use the dataset to create visualizations and dashboards using the prediction data. 7. The data refresh starts every time you save the dataset. You can start the data refresh process manually by refreshing the SPICE dataset, or you can schedule it to run at a regular interval. During each data refresh, the system automatically calls SageMaker AI batch transform to update the output fields with new data. You can use the Amazon QuickSight SPICE ingestion API operations to control the data refresh process. For more information about using these API operations, see the Amazon QuickSight API Reference. How SageMaker AI integration works 633 Amazon QuickSight User Guide Costs incurred (no additional costs with integration itself) Using this feature doesn't require an additional fee in itself. Your costs include the following: • The cost of model deployment through SageMaker AI, which is incurred only when the model is running. Saving a dataset—after either creating or editing it—or refreshing its data starts the data ingestion process. This process includes calling SageMaker AI if the dataset has inferred fields. Costs are incurred in the same AWS account where your QuickSight subscription is. • Your QuickSight subscription costs are as follows: • The cost of storing your data in the in-memory calculation engine in QuickSight (SPICE). If you are adding new data to SPICE, you might need to purchase enough SPICE capacity to accommodate it. • QuickSight subscriptions for the authors or admins who build the datasets. • Pay-per-session charges for viewers (readers) to access interactive dashboards. Usage guidelines In Amazon QuickSight, the following usage guidelines apply to this Enterprise edition feature: • The processing of the model occurs in SPICE. Therefore, it can only apply to datasets that are stored in SPICE. The process currently supports up to 500 million rows per dataset. • Only QuickSight admins or authors can augment datasets with ML models. Readers can only view the results when they are part of a dashboard. • Each dataset can work with one and only one ML model. • Output fields can't be used to calculate new fields. • Datasets can't be filtered by fields that are integrated with the model. In other words, if your dataset field is currently mapped to the ML model, you can't filter on that field. In SageMaker AI, the following usage guidelines apply to a pretrained model that you use with Amazon QuickSight: • When you create the model, associate it with the Amazon Resource Name (ARN) for the appropriate IAM role. The IAM role for the SageMaker AI model needs to have access to the Amazon S3 bucket that Amazon QuickSight uses. Costs incurred (no additional costs with integration itself) 634 Amazon QuickSight User Guide • Make sure that your model supports .csv files for both input and output. Make sure that your data is in a tabular format. • Provide a schema file that contains metadata about the model, including the list of input and output fields. Currently, you must create
amazon-quicksight-user-171
amazon-quicksight-user.pdf
171
• When you create the model, associate it with the Amazon Resource Name (ARN) for the appropriate IAM role. The IAM role for the SageMaker AI model needs to have access to the Amazon S3 bucket that Amazon QuickSight uses. Costs incurred (no additional costs with integration itself) 634 Amazon QuickSight User Guide • Make sure that your model supports .csv files for both input and output. Make sure that your data is in a tabular format. • Provide a schema file that contains metadata about the model, including the list of input and output fields. Currently, you must create this schema file manually. • Consider the amount of time that it takes to complete your inference, which depends on a number of factors. These include the complexity of the model, the amount of data, and the compute capacity defined. Completing the inference can take several minutes to several hours. Amazon QuickSight caps all data ingestion and inferencing jobs to a maximum of 10 hours. To reduce the time it takes to perform an inference, consider increasing the instance size or the number of instances. • Currently, you can use only batch transforms for integration with SageMaker AI, not real-time data. You can't use an SageMaker AI endpoint. Defining the schema file Before you use an SageMaker AI model with Amazon QuickSight data, create the JSON schema file that contains the metadata that Amazon QuickSight needs to process the model. The Amazon QuickSight author or admin uploads the schema file when configuring the dataset. The schema fields are defined as follows. All fields are required unless specified in the following description. Attributes are case-sensitive. inputContentType The content type that this SageMaker AI model expects for the input data. The only supported value for this is "text/csv". QuickSight doesn't include any of the header names that you add to the input file. outputContentType The content type of the output that is produced by the SageMaker AI model that you want to use. The only supported value for this is "text/csv". input A list of features that the model expects in the input data. QuickSight produces the input data in exactly the same order. This list contains the following attributes: • name – The name of the column. If possible, make this the same as the name of the corresponding column in the QuickSight dataset. This attribute is limited to 100 characters. Defining the schema file 635 Amazon QuickSight User Guide • type – The data type of this column. This attribute takes the values "INTEGER", "STRING", and "DECIMAL". • nullable – (Optional) The nullability of the field. The default value is true. If you set nullable to false, QuickSight drops rows that don't contain this value before calling SageMaker AI. Doing this helps avoid causing SageMaker AI to fail on missing required data. output A list of output columns that the SageMaker AI model produces. QuickSight expects these fields in exactly the same order. This list contains the following attributes: • name – This name becomes the default name for the corresponding new column that's created in QuickSight. You can override the name specified here in QuickSight. This attribute is limited to 100 characters. • type – The data type of this column. This attribute takes the values "INTEGER", "STRING", and "DECIMAL". instanceTypes A list of the ML instance types that SageMaker AI can provision to run the transform job. The list is provided to the QuickSight user to choose from. This list is limited to the types supported by SageMaker AI. For more information on supported types, see TransformResources in the SageMaker AI Developer Guide. defaultInstanceType (Optional) The instance type that is presented as the default option in the SageMaker AI wizard in QuickSight. Include this instance type in instanceTypes. instanceCount (Optional) The instance count defines how many of the selected instances for SageMaker AI to provision to run the transform job. This value must be a positive integer. description This field provides a place for the person who owns the SageMaker AI model to communicate with the person who is using this model in QuickSight. Use this field to provide hints about successfully using this model. For example, this field can contain information about selecting an effective instance type to choose from the list in instanceTypes, based on the size of dataset. This field is limited to 1,000 characters. Defining the schema file 636 Amazon QuickSight version The version of the schema, for example "1.0". User Guide The following example shows the structure of the JSON in the schema file. { "inputContentType": "CSV", "outputContentType": "CSV", "input": [ { "name": "buying", "type": "STRING" }, { "name": "maint", "type": "STRING" }, { "name": "doors", "type": "INTEGER" }, { "name": "persons", "type": "INTEGER" }, { "name": "lug_boot", "type": "STRING" }, { "name":
amazon-quicksight-user-172
amazon-quicksight-user.pdf
172
field can contain information about selecting an effective instance type to choose from the list in instanceTypes, based on the size of dataset. This field is limited to 1,000 characters. Defining the schema file 636 Amazon QuickSight version The version of the schema, for example "1.0". User Guide The following example shows the structure of the JSON in the schema file. { "inputContentType": "CSV", "outputContentType": "CSV", "input": [ { "name": "buying", "type": "STRING" }, { "name": "maint", "type": "STRING" }, { "name": "doors", "type": "INTEGER" }, { "name": "persons", "type": "INTEGER" }, { "name": "lug_boot", "type": "STRING" }, { "name": "safety", "type": "STRING" } ], "output": [ { "name": "Acceptability", "type": "STRING" } ], "description": "Use ml.m4.xlarge instance for small datasets, and ml.m4.4xlarge for datasets over 10 GB", Defining the schema file 637 Amazon QuickSight User Guide "version": "1.0", "instanceCount": 1, "instanceTypes": [ "ml.m4.xlarge", "ml.m4.4xlarge" ], "defaultInstanceType": "ml.m4.xlarge" } The structure of the schema file is related to the kind of model that is used in examples provided by SageMaker AI. Adding a SageMaker AI model to your QuickSight dataset Using the following procedure, you can add a pretrained SageMaker AI model to your dataset, so that you can use predictive data in analyses and dashboards. Before you begin, have the following items available: • The data that you want to use to build the dataset. • The name of the SageMaker AI model that you want to use to augment the dataset. • The schema of the model. This schema includes field name mappings and data types. It's helpful if it also contains recommended settings for instance type and number of instances to use. To augment your Amazon QuickSight dataset with SageMaker AI 1. Create a new dataset from the start page by choosing Datasets, and then choose New dataset. You can also edit an existing dataset. 2. Choose Augment with SageMaker on the data preparation screen. 3. For Select your model, choose the following settings: • Model – Choose the SageMaker AI model to use to infer fields. • Name – Provide a descriptive name for the model. • Schema – Upload the JSON schema file provided for the model. • Advanced settings – QuickSight recommends the selected defaults based on your dataset. You can use specific runtime settings to balance the speed and cost of your job. To do this, Adding a SageMaker AI model to your QuickSight dataset 638 Amazon QuickSight User Guide enter the SageMaker AI ML instance types for Instance type and number of instances for Count. Choose Next to continue. 4. For Review inputs, review the fields that are mapped to your dataset. QuickSight attempts to automatically map the fields in your schema to the fields in your dataset. You can make changes here if the mapping needs adjustment. Choose Next to continue. 5. For Review outputs, view the fields that are added to your dataset. Choose Save and prepare data to confirm your choices. 6. To refresh the data, choose the dataset to view details. Then either choose Refresh Now to manually refresh the data, or choose Schedule refresh to set up a regular refresh interval. During each data refresh, the system automatically runs the SageMaker AI batch transform job to update the output fields with new data. Build predictive models with SageMaker AI Canvas QuickSight authors can export data into SageMaker AI Canvas to build ML models that can be sent back to QuickSight. Authors can use these ML models to augment their datasets with predictive analytics that can be used to build analyses and dashboards. Prerequisites • A QuickSight account that's integrated with IAM Identity Center. If your QuickSight account isn't integrated with IAM Identity Center, create a new QuickSight account and choose Use IAM Identity Center enabled application as the identity provider. • For more information on IAM Identity Center, see Getting started. • To learn more about integrating your QuickSight with IAM Identity Center, see Configure your Amazon QuickSight account with IAM Identity Center. • To import assets from an existing QuickSight account to a new QuickSight account that's integrated with IAM Identity Center, see Asset bundle operations. • A new SageMaker AI domain that is integrated with IAM Identity Center. For more information about onboarding to SageMaker AI Domain with IAM Identity Center, see Onboard to SageMaker AI Domain using IAM Identity Center. SageMaker AI Canvas 639 Amazon QuickSight Topics User Guide • Build a predictive model in SageMaker AI Canvas from Amazon QuickSight • Create a dataset with a SageMaker AI Canvas model • Considerations Build a predictive model in SageMaker AI Canvas from Amazon QuickSight To build a predictive model in SageMaker AI Canvas 1. Log in to QuickSight and navigate to the tabular table or pivot table that you want to create a predictive
amazon-quicksight-user-173
amazon-quicksight-user.pdf
173
IAM Identity Center. For more information about onboarding to SageMaker AI Domain with IAM Identity Center, see Onboard to SageMaker AI Domain using IAM Identity Center. SageMaker AI Canvas 639 Amazon QuickSight Topics User Guide • Build a predictive model in SageMaker AI Canvas from Amazon QuickSight • Create a dataset with a SageMaker AI Canvas model • Considerations Build a predictive model in SageMaker AI Canvas from Amazon QuickSight To build a predictive model in SageMaker AI Canvas 1. Log in to QuickSight and navigate to the tabular table or pivot table that you want to create a predictive model for. 2. Open the on-visual menu and choose Build a predictive model. 3. 4. In the Build a predictive model in SageMaker AI Canvas pop up that appears, review the information presented and then choose EXPORT DATA TO SAGEMAKER CANVAS. In the Exports pane that appears, choose GO TO SAGEMAKER CANVAS when the export is completed to go to the SageMaker AI Canvas console. 5. In SageMaker AI Canvas, create a predictive model with the data that you exported from QuickSight. You can choose to follow a guided tour that helps you create the predictive model, or you can skip the tour and work at your own pace. For more information about creating a predictive model in SageMaker AI Canvas, see Build a model. 6. Send the predictive model back to QuickSight. For more information about sending a model from SageMaker AI Canvas to Amazon QuickSight, see Send your model to Amazon QuickSight. Create a dataset with a SageMaker AI Canvas model After you create a predictive model in SageMaker AI Canvas and send it back to QuickSight, use the new model to create a new dataset or apply it to an existing dataset. To add a predictive field to a dataset 1. Open the QuickSight console, navigate to the Datasets page, and choose Datasets. 2. Upload a new dataset or choose an existing dataset. 3. Choose Edit. SageMaker AI Canvas 640 Amazon QuickSight User Guide 4. On the dataset' data prep page, choose ADD, and then choose Add predictive field to open the Augment with SageMaker AI modal. 5. For Model, choose the model that you sent to QuickSight from SageMaker AI Canvas. The schema file automatically populates in the Advanced settings pane. Review the inputs, and then choose Next. 6. On the Review outputs pane, enter a field name and description for a colum to be targeted by the model that you created in SageMaker AI Canvas. 7. When you are finished, choose Prepare data. 8. After you choose Prepare data, you are redirected to the dataset page. To publish the new dataset, choose, Publish & Visuallize. When you publish a new dataset that uses a model from SageMaker AI Canvas, the data is imported into SPICE and a batch inference job begins in SageMaker AI. It can take up to 10 minutes for these processes to complete. Considerations The following limitations apply to the creation of SageMaker AI Canvas models with QuickSight data. • The Build a predictive model option that is used to send data to SageMaker AI Canvas is only available on table and tabular pivot table visuals. The table or pivot table visual must have between 2 and 1,000 fields and at least 500 rows. • Datasets that contain integer or geographic data types will experience schema mapping errors when you add a predictive field to the dataset. To resolve this issue, remove the integer or geographic data types from the dataset or convert them to a new data type. Preparing dataset examples You can prepare data in any dataset to make it more suitable for analysis, for example changing a field name or adding a calculated field. For database datasets, you can also determine the data used by specifying a SQL query or joining two or more tables. Use the following topics to learn how to prepare datasets. Topics Preparing dataset examples 641 Amazon QuickSight User Guide • Preparing a dataset based on file data • Preparing a dataset based on Salesforce data • Preparing a dataset based on database data Preparing a dataset based on file data Use the following procedure to prepare a dataset based on text or Microsoft Excel files from either your local network or Amazon S3. To prepare a dataset based on text or Microsoft Excel files from a local network or S3 1. Open a file dataset for data preparation by choosing one of the following options: • Create a new local file dataset, and then choose Edit/Preview data. For more information about creating a new dataset from a local text file, see Creating a dataset using a local text file. For more information about creating a new dataset from a Microsoft Excel file, see Creating
amazon-quicksight-user-174
amazon-quicksight-user.pdf
174
to prepare a dataset based on text or Microsoft Excel files from either your local network or Amazon S3. To prepare a dataset based on text or Microsoft Excel files from a local network or S3 1. Open a file dataset for data preparation by choosing one of the following options: • Create a new local file dataset, and then choose Edit/Preview data. For more information about creating a new dataset from a local text file, see Creating a dataset using a local text file. For more information about creating a new dataset from a Microsoft Excel file, see Creating a dataset using a Microsoft Excel file. • Create a new Amazon S3 dataset, and then choose Edit/Preview data. For more information about creating a new Amazon S3 dataset using a new Amazon S3 data source, see Creating a dataset using Amazon S3 files. For more information about creating a new Amazon S3 dataset using an existing Amazon S3 data source, see Creating a dataset using an existing Amazon S3 data source. • Open an existing Amazon S3, text file, or Microsoft Excel dataset for editing, from either the analysis page or the Your Datasets page. For more information about opening an existing dataset for data preparation, see Editing datasets. 2. (Optional) On the data preparation page, enter a new name into the dataset name box on the application bar. This name defaults to the file name for local files. For example, it defaults to Group 1 for Amazon S3 files. 3. Review the file upload settings and correct them if necessary. For more information about file upload settings, see Choosing file upload settings. Preparing a dataset based on file data 642 Amazon QuickSight User Guide Important If you want to change upload settings, make this change before you make any other changes to the dataset. New upload settings cause Amazon QuickSight to reimport the file. This process overwrites all of your other changes. 4. Prepare the data by doing one or more of the following: • Selecting fields • Editing field names and descriptions • Changing a field data type • Adding calculated fields • Filtering data in Amazon QuickSight 5. Check the SPICE indicator to see if you have enough capacity to import the dataset. File datasets automatically load into SPICE. The import happens when you choose either Save & visualize or Save. If you don't have access to enough SPICE capacity, you can make the dataset smaller by using one of the following options: • Apply a filter to limit the number of rows. • Select fields to remove from the dataset. Note The SPICE indicator doesn't update to how much space you save by removing fields or filtering the data. It continues to reflect the SPICE usage from the last import. 6. Choose Save to save your work, or Cancel to cancel it. You might also see Save & visualize. This option appears based on the screen that you started from. If this option isn't there, you can create a new visualization by starting from the dataset screen. Preparing a dataset based on file data 643 Amazon QuickSight User Guide Preparing a dataset based on a Microsoft Excel file Use the following procedure to prepare a Microsoft Excel dataset. To prepare a Microsoft Excel dataset 1. Open a text file dataset for preparation by choosing one of the following options: • Create a new Microsoft Excel dataset, and then choose Edit/Preview data. For more information about creating a new Excel dataset, see Creating a dataset using a Microsoft Excel file. • Open an existing Excel dataset for editing. You can do this from the analysis page or the Your Datasets page. For more information about opening an existing dataset for data preparation, see Editing datasets. 2. (Optional) On the data preparation page, enter a name into the dataset name box in the application bar. If you don't rename the dataset, its name defaults to the Excel file name. 3. Review the file upload settings and correct them if necessary. For more information about file upload settings, see Choosing file upload settings. Important If it's necessary to change upload settings, make this change before you make any other changes to the dataset. Changing upload settings causes Amazon QuickSight to reimport the file. This process overwrites any changes you have made so far. 4. 5. (Optional) Change the worksheet selection. (Optional) Change the range selection. To do this, open Upload Settings from the on-dataset menu beneath the login name at upper right. 6. Prepare the data by doing one or more of the following: • Selecting fields • Editing field names and descriptions • Changing a field data type • Adding calculated fields • Filtering data in Amazon QuickSight Preparing a dataset based on file data 644 Amazon
amazon-quicksight-user-175
amazon-quicksight-user.pdf
175
other changes to the dataset. Changing upload settings causes Amazon QuickSight to reimport the file. This process overwrites any changes you have made so far. 4. 5. (Optional) Change the worksheet selection. (Optional) Change the range selection. To do this, open Upload Settings from the on-dataset menu beneath the login name at upper right. 6. Prepare the data by doing one or more of the following: • Selecting fields • Editing field names and descriptions • Changing a field data type • Adding calculated fields • Filtering data in Amazon QuickSight Preparing a dataset based on file data 644 Amazon QuickSight User Guide 7. Check the SPICE indicator to see if you have enough space to import the dataset. Amazon QuickSight must import Excel datasets into SPICE. This import happens when you choose either Save & visualize or Save. If you don't have enough SPICE capacity, you can choose to make the dataset smaller using one of the following methods: • Apply a filter to limit the number of rows. • Select fields to remove from the dataset. • Define a smaller range of data to import. Note The SPICE indicator doesn't update to reflect your changes until after your load them. It shows the SPICE usage from the last import. 8. Choose Save to save your work, or Cancel to cancel it. You might also see Save & visualize. This option appears based on the screen that you started from. If this option isn't there, you can create a new visualization by starting from the dataset screen. Preparing a dataset based on Salesforce data Use the following procedure to prepare a Salesforce dataset. To prepare a Salesforce dataset 1. Open a Salesforce dataset for preparation by choosing one of the following options: • Create a new Salesforce dataset and choose Edit/Preview data. For more information about creating a new Salesforce dataset using a new Salesforce data source, see Creating a dataset from Salesforce. For more information about creating a new Salesforce dataset using an existing Salesforce data source, see Create a dataset using an existing Salesforce data source. • Open an existing Salesforce dataset for editing from either the analysis page or the Your Datasets page. For more information about opening an existing dataset for data preparation, see Editing datasets. Preparing a dataset based on Salesforce data 645 Amazon QuickSight User Guide 2. (Optional) On the data preparation page, enter a name into the dataset name box in the application bar if you want to change the dataset name. This name defaults to the report or object name. 3. 4. (Optional) Change the data element selection to see either reports or objects. (Optional) Change the data selection to choose a different report or object. If you have a long list in the Data pane, you can search to locate a specific item by entering a search term into the Search tables box. Any item whose name contains the search term is shown. Search is case-insensitive and wildcards are not supported. Choose the cancel icon (X) to the right of the search box to return to viewing all items. 5. Prepare the data by doing one or more of the following: • Selecting fields • Editing field names and descriptions • Changing a field data type • Adding calculated fields • Filtering data in Amazon QuickSight 6. Check the SPICE indicator to see if you have enough space to import the dataset. Importing data into SPICE is required for Salesforce datasets. Importing occurs when you choose either Save & visualize or Save. If you don't have enough SPICE capacity, you can remove fields from the dataset or apply a filter to decrease its size. For more information about adding and removing fields from a dataset, see Selecting fields. Note The SPICE indicator doesn't update to reflect the potential savings of removing fields or filtering the data. It continues to reflect the size of the dataset as retrieved from the data source. 7. Choose Save to save your work, or Cancel to cancel it. You might also see Save & visualize. This option appears based on the screen you started from. If this option isn't there, you can create a new visualization by starting from the dataset screen. Preparing a dataset based on Salesforce data 646 Amazon QuickSight User Guide Preparing a dataset based on database data Use the following procedure to prepare a dataset based on a query to a database. The data for this dataset can be from an AWS database data source like Amazon Athena, Amazon RDS, or Amazon Redshift, or from an external database instance. You can choose whether to import a copy of your data into SPICE, or to query the data directly. To prepare a dataset based on a query to a database 1. Open
amazon-quicksight-user-176
amazon-quicksight-user.pdf
176
visualization by starting from the dataset screen. Preparing a dataset based on Salesforce data 646 Amazon QuickSight User Guide Preparing a dataset based on database data Use the following procedure to prepare a dataset based on a query to a database. The data for this dataset can be from an AWS database data source like Amazon Athena, Amazon RDS, or Amazon Redshift, or from an external database instance. You can choose whether to import a copy of your data into SPICE, or to query the data directly. To prepare a dataset based on a query to a database 1. Open a database dataset for preparation by choosing one of the following options: • Create a new database dataset and choose Edit/Preview data. For more information about creating a new dataset using a new database data source, see Creating a dataset from a database. For more information about creating a new dataset using an existing database data source, see Creating a dataset using an existing database data source. • Open an existing database dataset for editing from either the analysis page or the Your Datasets page. For more information about opening an existing dataset for data preparation, see Editing datasets. 2. (Optional) On the data preparation page, enter a name into the dataset name box on the application bar. This name defaults to the table name if you selected one before data preparation. Otherwise, it's Untitled data source. 3. Decide how your data is selected by choosing one of the following: • To use a single table to provide data, choose a table or change the table selection. If you have a long table list in the Tables pane, you can search for a specific table by typing a search term for Search tables. Any table whose name contains the search term is shown. Search is case-insensitive and wildcards are not supported. Choose the cancel icon (X) to the right of the search box to return to viewing all tables. • To use two or more joined tables to provide data, choose two tables and join them using the join pane. You must import data into QuickSight if you choose to use joined tables. For more information about joining data using the Amazon QuickSight interface, see Joining data. • To use a custom SQL query to provide data in a new dataset, choose Switch to Custom SQL tool on the Tables pane. For more information, see Using SQL to customize data. Preparing a dataset based on database data 647 Amazon QuickSight User Guide To change the SQL query in an existing dataset, choose Edit SQL on the Fields pane to open the SQL pane and edit the query. 4. Prepare the data by doing one or more of the following: • Selecting fields • Editing field names and descriptions • Changing a field data type • Adding calculated fields • Filtering data in Amazon QuickSight 5. If you aren't joining tables, choose whether to query the database directly or to import the data into SPICE by selecting either the Query or SPICE radio button. We recommend using SPICE for enhanced performance. If you want to use SPICE, check the SPICE indicator to see if you have enough space to import the dataset. Importing occurs when you choose either Save & visualize or Save. If you don't have enough space, you can remove fields from the dataset or apply a filter to decrease its size. Note The SPICE indicator doesn't update to reflect the potential savings of removing fields or filtering the data. It continues to reflect the size of the dataset as retrieved from the data source. 6. Choose Save to save your work, or Cancel to cancel it. You might also see an option to Save & visualize. This option appears based on the screen you started from. If this option isn't there, you can create a new visualization by starting from the dataset screen. Preparing a dataset based on database data 648 Amazon QuickSight User Guide Visualizing data in Amazon QuickSight Following, you can find descriptions of how to create and customize Amazon QuickSight charts, arrange charts in a dashboard, and more. Topics • Working with an analysis in Amazon QuickSight • Adding and managing sheets • Working with interactive sheets in Amazon QuickSight • Working with paginated reports in Amazon QuickSight • Working with items on sheets in Amazon QuickSight analyses • Using themes in Amazon QuickSight • Accessing Amazon QuickSight using keyboard shortcuts Working with an analysis in Amazon QuickSight In Amazon QuickSight, an analysis is the same thing as a dashboard, except that it can only be accessed by the authors you choose. You can keep it private, and make it as robust and detailed as you like. When and if you decide to publish it,
amazon-quicksight-user-177
amazon-quicksight-user.pdf
177
Amazon QuickSight • Adding and managing sheets • Working with interactive sheets in Amazon QuickSight • Working with paginated reports in Amazon QuickSight • Working with items on sheets in Amazon QuickSight analyses • Using themes in Amazon QuickSight • Accessing Amazon QuickSight using keyboard shortcuts Working with an analysis in Amazon QuickSight In Amazon QuickSight, an analysis is the same thing as a dashboard, except that it can only be accessed by the authors you choose. You can keep it private, and make it as robust and detailed as you like. When and if you decide to publish it, the shared version of it is called a dashboard. Use the following sections to learn how to interact with a QuickSight analysis. Topics • Starting an analysis in Amazon QuickSight • Adding a title and description to an analysis • Renaming an analysis • Duplicating analyses • Viewing analysis details • Customize date and time values of an analysis • The analysis menu • Configure analysis settings • Item limits for Amazon QuickSight analyses in the QuickSight APIs • Saving changes to analyses Working with an analysis 649 Amazon QuickSight User Guide • Exporting data from QuickSight analyses • Deleting an analysis Starting an analysis in Amazon QuickSight In Amazon QuickSight, you analyze and visualize your data in analyses. When you're finished, you can publish your analysis as a dashboard to share with others in your organization. Use the following procedure to create a new analysis. To create a new analysis 1. On the QuickSight start page, choose Analyses, and then choose New analysis. 2. Choose the dataset that you want to include in your new analysis, and then choose USE IN ANALYSIS in the top right. 3. In the New sheet pop-up that appears, choose the sheet type that you want. You can choose between an Interactive sheet and a Paginated report. To create a paginated report, you need the paginated reports add-on for your account. For more information about paginated reports, see Working with paginated reports in Amazon QuickSight. For more information on sheets, see Adding and managing sheets. 4. (Optional) If you choose Interactive sheet, follow these steps: • (Optional): Choose the type layout that you want for your interactive sheet. You can choose one of the following options: • Free-form • Tiled The default option is Free-form. For more information about interactive sheet layouts, see Types of layout. • Choose the canvas size that you want your sheet optimized for. You can choose one of the following options: • 1024px • 1280px • 1366px • 1600px Starting an analysis 650 Amazon QuickSight • 1920px User Guide For more information on formatting interactive sheets, see Working with interactive sheets in Amazon QuickSight. 5. (Optional) If you choose Paginated report, follow these steps: • (Optional) Choose the paper size that you want for your paginated report. You can choose from the following options: • US letter (8.5 x 11 in.) • US legal (8.5 x 14 in.) • A0 (841 x 1189 mm) • A1 (594 x 841 mm) • A2 (420 x 594 mm) • A3 (297 x 420 mm) • A4 (210 x 297 mm) • A5 (148 x 210 mm) Starting an analysis 651 Amazon QuickSight User Guide • Japan B4 (257 x 364 mm) • Japan B5 (182 x 257 mm) The default paper size is US letter (8.5 x 11 in.) • (Optional) Choose the orientation of the sheet. You can choose between Portrait or Landscape. The default option is portrait. Before you can create Amazon QuickSight paginated reports, first get the paginated reporting add-on for your QuickSight account. For more information on getting the paginated reporting add-on, see Get the QuickSight paginated reports add-on. For more information on formatting paginated reports, see Working with paginated reports in Amazon QuickSight. 6. Choose Add. 7. Create a visual. For more information about creating visuals, see Adding visuals to Amazon QuickSight analyses. Starting an analysis 652 Amazon QuickSight User Guide After you are done creating the analysis, you can iterate on it by modifying the visual, adding more visuals, adding scenes to the default story, or adding more stories. Adding a title and description to an analysis In addition to the analysis name, you can add a title and description to an analysis. A useful title and description provides context about the information in the analysis. Add a title and description Use the following procedure to add a title and description to an analysis. Titles and descriptions can contain up to 1,024 characters. Titles and descriptions are not supported for paginated reports. To add a title and description to an analysis 1. On the analysis page, choose Sheets in the application bar and then choose Add title. The image below shows the open Sheets menu
amazon-quicksight-user-178
amazon-quicksight-user.pdf
178
an analysis In addition to the analysis name, you can add a title and description to an analysis. A useful title and description provides context about the information in the analysis. Add a title and description Use the following procedure to add a title and description to an analysis. Titles and descriptions can contain up to 1,024 characters. Titles and descriptions are not supported for paginated reports. To add a title and description to an analysis 1. On the analysis page, choose Sheets in the application bar and then choose Add title. The image below shows the open Sheets menu in the application bar. 2. For Sheet title, enter a title and press Enter. To remove a title, choose Sheets in the application bar and then choose Delete title. Or, to remove the title, you can select the title and then choose the x-shaped delete icon. To create a dynamic sheet title, you can add existing parameters to the sheet title. For more information, see Using parameters in titles and descriptions in Amazon QuickSight. 3. Choose Sheets in the application bar, and then choose Add description. 4. In the description space that appears on the sheet, enter the description that you want and press Enter. To remove a description, choose Sheets in the application bar and then choose Delete description. Or, to remove the description, you can select the description and then choose the x-shaped delete icon. Adding titles and descriptions to an analysis 653 Amazon QuickSight Renaming an analysis Use the following procedure to rename an analysis. To rename an analysis 1. Open the analysis that you want to rename. User Guide 2. In the Analysis name box in the application bar, select the current name and then enter a new name. Duplicating analyses You can duplicate analyses in Amazon QuickSight. Use the following procedure to learn how. To duplicate an analysis 1. 2. 3. From the QuickSight start page, choose Analyses, and then open the analysis that you want to duplicate. In the analysis, choose Save as in the application bar at upper right. In the Save a copy page that opens, enter a name for the analysis, and then choose Save. The new analysis opens. You can find the original analysis by returning to the QuickSight start page and selecting Analyses. Viewing analysis details To view an analysis, locate the analysis on the All analyses tab of the Amazon QuickSight start page. Then choose the analysis. Renaming an analysis 654 Amazon QuickSight User Guide Customize date and time values of an analysis In Amazon QuickSight, authors can set custom time zones and week start days of an analysis. When you set a custom week start or time zone, all visuals in the analysis that use datetime data are formatted to reflect the time zone or week start that the analysis uses. Setting custom time zones in an analysis QuickSight authors can use custom time zones to help manage data across multiple geographic regions. When you set a custom time zone, all visible dimensions, measures, calculated fields, and filters are converted to the chosen time zone at query run time. Daylight Savings Time (DST) adjustments are applied automatically to eliminate the need for time consuming workarounds that don't accurately handle historical dates. Custom time zones refer to the use of IANA time zone abbreviations that represent specific geographic regions around the world. Each time zone is defined as an offset from Coordinated Universal Time (UTC). Time zones are different from simple offsets because they incorporate DST. The default time zone for all analyses is UTC. The following rules apply to time zones. • Datetime displays with a granularity that is lower than hour are converted to the selected time zone. For example, if you set the timezone of an analysis to America/New_York (UTC-04:00), the datetime value Dec.1, 2020 12:00am in UTC+00:00 is converted and displayed as Nov.30, 2020 7:00pm. Daylight Savings Time (DST) is incorporated into the datetime conversion. • Datetime literals that are added to calculations or selected in filters honor the selected time zone of the analysis. For example, if you manually enter a literal into a calculated field such as 01-01-2022 7:00pm, or select a fixed filter time, QuickSight applies the chosen timezone to the literal value. • Measures that are aggregated above the hour/minute granularity are aggregated based on the timezone that the analyss is set to. When QuickSight processes a dataset, all timestamps are initially converted at the lowest granularity level. Values are then aggregated based on the boundary of the selected time zone for the analysis. For example, a sum of hourly revenues at the day level with a UTC+00:00 time zone aggregate all hourly revenues from 12am-11pm for the UTC time zone. When you convert UTC+00:00 to New_York (UTC-04:00), all revenue
amazon-quicksight-user-179
amazon-quicksight-user.pdf
179
fixed filter time, QuickSight applies the chosen timezone to the literal value. • Measures that are aggregated above the hour/minute granularity are aggregated based on the timezone that the analyss is set to. When QuickSight processes a dataset, all timestamps are initially converted at the lowest granularity level. Values are then aggregated based on the boundary of the selected time zone for the analysis. For example, a sum of hourly revenues at the day level with a UTC+00:00 time zone aggregate all hourly revenues from 12am-11pm for the UTC time zone. When you convert UTC+00:00 to New_York (UTC-04:00), all revenue datapoints are aggregated from 8:00pm-7:00pm(+1day) in UTC to correspond with the start and end of the day in New_York (UTC-04:00). Date and time settings 655 Amazon QuickSight User Guide • The now() function, rolling date filter, and parameters are converted to the chosen time zone. Relative date filters, rolling date filters, and relative date parameters that use the now() function also honor the chosen time zone when they are applied to the visual. For example, when you select a relative filter such as last week or a rolling date filter such as start of the month, the chosen timezone is automatically applied to the filter to display the values last week of New_York time zone and start of the month of New_York time zone, respectively. To set the custom time zone of an analysis 1. From the analysis that you want to change, navigate to the top menu and choose Edit. 2. Choose Analysis settings, and then choose Date and time. 3. Toggle Convert time zone ON, and choose the Time zone that you want. 4. Choose Apply. When an analysis is assigned a time zone, an icon appears at the top of the analysis that indicates which time zone the analysis uses. This icon also appears on any dashboard that is published from the analysis. Considerations The following considerations apply to custom time zones. Date and time settings 656 Amazon QuickSight User Guide • To use custom time zones, all datetime columns in a dataset must be normalized to UTC. If your datetime columns aren't normalized in your data source, you need to convert the columns in your data source before you can use this feature. • For analyses that are not assigned a custom time zone, author and reader experiences are unaffected. • Once a time zone is added to an analysis, the time zone is applied to all visuals and sheets in the analysis. • QuickSight authors can choose only one time zone for an analysis. All dashboards that are published from the analysis use the time zone that the analysis uses. To create a dashboard that uses a different time zone than the one that the analysis uses, change the time zone of the analysis and republish the dashboard. • QuickSight readers can't change the time zone of a dashboard. • If you set the time zone of an analysis that uses a dataset that is stored in Direct Query and experience slow load times, consider storing the dataset in SPICE. SPICE is engineered to handle time zone conversions in a performant way. • Custom time zones do not support the following database engines: • Timestream • OpenSearch Service • Teradata • SqlServer Setting custom week start days in an analysis QuickSight authors can define the week start day of an analysis to align their data with the schedule that their company or industry follows. When you set a custom week start day, all dimensions, calculated fields, and filters that are aggregated at the week level are calculated to align with the new week start day. The default week start day is Sunday. To set the custom week start day of an analysis 1. From the analysis that you want to change, navigate to the top menu and choose Edit. 2. Choose Analysis settings, and then choose Date and time. 3. For Custom start day, choose the start day that you want. 4. Choose Apply. Date and time settings 657 Amazon QuickSight Considerations User Guide The following considerations apply to custom week start days. • Datetime fields are converted at run time. When you work with calculated fields that use datetime values, define the fields at the analysis level instead of the dataset level. • Once you choose a new week start day, the change is applied to all visuals and sheets in the analysis. • QuickSight authors can choose only one week start day for an analysis. All dashboards that are published from the analysis use the week start day that the analysis uses. To create a dashboard that uses a different week start day than the one that the analysis uses, change the week start day of the analysis and republish the dashboard. •
amazon-quicksight-user-180
amazon-quicksight-user.pdf
180
calculated fields that use datetime values, define the fields at the analysis level instead of the dataset level. • Once you choose a new week start day, the change is applied to all visuals and sheets in the analysis. • QuickSight authors can choose only one week start day for an analysis. All dashboards that are published from the analysis use the week start day that the analysis uses. To create a dashboard that uses a different week start day than the one that the analysis uses, change the week start day of the analysis and republish the dashboard. • QuickSight readers can't change the week start day of a dashboard. The analysis menu While working on an analysis, Amazon QuickSight provides menu options, as shown at the top of the following screenshot. You use these menu options to efficiently perform tasks without needing to manually navigate through your analysis to find the assets that you want to change. The analysis menu 658 Amazon QuickSight User Guide You can use these options to perform the following tasks. • File – Perform analysis management tasks, including creating, sharing, and publishing. Authors can use this option to make changes across all sheets or visuals in an analysis. • Edit – Navigate between changes that you make to the analysis. You can undo or redo changes that you make. • Data – Manage datasets, data fields, and parameters. Changes that you make by using this option are applied to all sheets in the analysis. • Insert – Use an ingress point where you can add visuals, text boxes, insights, reporting objects, filters, and parameters to an analysis. The content that you insert can be data or objects. • Sheets – Manage the sheet settings of the analysis, including layout settings, actions to add or remove assets from a sheet, and sheet properties. • Objects – Manage objects and their features, including style, canvas placement, sizing, card background, and borders. You can also manage these objects by using the Properties pane when working on a visual object. The analysis menu 659 Amazon QuickSight User Guide • Search – Access the Quick search bar. Quick search is a search bar that will begin showing results for the asset you are searching for as you type. The suggested results continue to modify as you type until you see the result that you're looking for. To use quick search, open the Search menu, and in the Search analysis actions box, begin typing a name or phrase associated with the asset you are trying to find. Configure analysis settings QuickSight authors can use the Analysis settings menu to configure the refresh and date time settings of an analysis. To access the Analysis Settings menu, choose Edit, and then choose Analysis Settings. The following settings can be configured in the Analysis settings menu: Refresh settings • Reload visuals every time I switch sheets – Use this setting to reload every visual in a QuickSight analysis whenever the user switches to a different sheet in the analysis. • Update visuals manually – Use this setting to only update applicable visuals in an analysis when the user applies their changes. When this setting is toggled on, the analysis loads the visuals blank by default because the queries won't be fired until the user selects the UPDATE VISUALS button located in the toolbar or on the impacted visuals. The UPDATE VISUALS button confirms that the user is finished with the filter and control choices that they want to apply to the affected visuals. The image below shows the UPDATE VISUALS button. When Update visuals manually is toggled on, authors can still add visuals, edit visuals, and edit control selections, but the affected visuals won't update until the author applies the new changes. This allows authors to build analyses without increasing their database load and gives better control over which values are loaded in an analysis. Configure analysis settings 660 Amazon QuickSight Date and time settings User Guide • Convert time zone – Use this setting to convert all date field related visualizations, filters, and parameters to reflect the chosen time zone. All daylight savings adjustments are made automatically. For more information about time zone configuration, see Customize date and time values of an analysis. • Start of the week – Use this setting to choose the week start day for an analysis. Interactivity • Use this setting to highlight specific data points across visuals in a sheet. When you select or hover over a data point on a visual, related data across other visuals will stand out, while unrelated data is dimmed. Highlighting allows you to understand correlations, spot patterns, trends, and outliers, and facilitate stronger, more informed analyses. Select either On selection or On hover to turn highlighting on, or No
amazon-quicksight-user-181
amazon-quicksight-user.pdf
181
time zone configuration, see Customize date and time values of an analysis. • Start of the week – Use this setting to choose the week start day for an analysis. Interactivity • Use this setting to highlight specific data points across visuals in a sheet. When you select or hover over a data point on a visual, related data across other visuals will stand out, while unrelated data is dimmed. Highlighting allows you to understand correlations, spot patterns, trends, and outliers, and facilitate stronger, more informed analyses. Select either On selection or On hover to turn highlighting on, or No highlight to turn it off. • To customize highlighting on a per-sheet level see Adding and managing sheets. Item limits for Amazon QuickSight analyses in the QuickSight APIs Use the following table to review the current limits or quotas for different analysis items in Amazon QuickSight that are created and managed with the Amazon QuickSight APIs. If your analysis contains more than the supported number of analysis items, remove items to optimize the performance of the analysis. New analysis items cannot be added to an analysis that contains more than the supported number of analysis items. Analysis item Limit Sheets Visuals Calculated fields Bookmarks Custom actions Filter groups 20 sheets per analysis 50 visuals per sheet 500 per analysis and 200 per dataset* 200 per dashboard 10 per visual 2000 per analysis Item limits for QuickSight analyses 661 Amazon QuickSight Analysis item Filters Parameters Controls Text boxes Image components Layer map visuals User Guide Limit 20 filters per filter group 200 per analysis 200 per sheet 100 per sheet 10 per sheet 5 per sheet * The per dataset limit applies to calculations that were created in the analysis. Dataset level calculations are not included in this limit. For more information about dataset level calculations, see Adding calculated fields. Saving changes to analyses When working on an analysis, you can set Autosave either on (the default) or off. When Autosave is on, your changes are automatically saved every minute or so. When Autosave is off, your changes aren't automatically saved, which means that you can make changes and pursue different lines of inquiry without permanently altering the analysis. If you decide that you want to save your results after all, re-enable Autosave. Your changes up to that point are then saved. In either Autosave mode, you can undo or redo up to 200 changes that you make by choosing Undo or Redo on the application bar. Changing the Autosave mode Changed to To change the Autosave mode for an analysis, choose File and then choose Autosave On or Autosave OFF. When Autosave can't save changes Suppose that one of the following things occurs: • Autosave is on and another user makes a conflicting change to the analysis. Saving changes to analyses 662 Amazon QuickSight User Guide • Autosave is on and there is a service failure, such that your most recent changes can't be saved. • Autosave is off, you turn it on, and one of the backlogged changes now being saved to the server conflicts with another user's changes. In this case, Amazon QuickSight gives you the option to do one of two things. You can either let Amazon QuickSight turn Autosave off and continue working in unsaved mode, or reload the analysis from the server and then redo your most recent changes. If your client authentication expires while you are editing an analysis, you are directed to sign in again. On successful sign-in, you are directed back to the analysis where you can continue working normally. If your permissions on the analysis are revoked while you are editing it, you can't make any further changes. Exporting data from QuickSight analyses Note Export files can directly return information from the dataset import. This makes the files vulnerable to CSV injection if the imported data contains formulas or commands. For this reason, export files can prompt security warnings. To avoid malicious activity, turn off links and macros when reading exported files. You can export data from an analysis to a CSV or PDF file. To export data from an analysis or dashboard to a CSV file, follow the procedure in Exporting data from visuals. Use the procedure below to export an analysis as a PDF. 1. From the analysis that you want to export, choose File > Export to PDF. QuickSight begins to prepare the analysis for download. 2. Choose VIEW EXPORTS in the blue pop-up to open the Exports pane on the right. Exporting data from analyses 663 Amazon QuickSight User Guide 3. Choose DOWNLOAD in the green pop-up. 4. To see all analyses or reports that are ready to download, choose File Exports. The Exports panel will open on the right side of the screen. Select Click to
amazon-quicksight-user-182
amazon-quicksight-user.pdf
182
Exporting data from visuals. Use the procedure below to export an analysis as a PDF. 1. From the analysis that you want to export, choose File > Export to PDF. QuickSight begins to prepare the analysis for download. 2. Choose VIEW EXPORTS in the blue pop-up to open the Exports pane on the right. Exporting data from analyses 663 Amazon QuickSight User Guide 3. Choose DOWNLOAD in the green pop-up. 4. To see all analyses or reports that are ready to download, choose File Exports. The Exports panel will open on the right side of the screen. Select Click to download next to the file that you want to save to your preferred location. The process for exporting to a PDF works the same way for both dashboards and analyses. You can also attach a PDF to dashboard email reports. For more information, see Scheduling and sending QuickSight reports by email. Deleting an analysis If you have the permissions to do so, you can delete an analysis from the Analyses page. When you delete an analysis, it doesn't affect any dashboards that are based on that analysis. They continue to show the deleted analysis, but you can't make changes to the analysis once you delete it. Navigate to the Analyses page and find the analysis that you want to remove. Choose the details icon (⋮) on the analysis, then choose Delete. Confirm your choice by choosing Delete again. You can't undo this action. Adding and managing sheets A sheet is a set of visuals that are viewed together in a single page. When you create an analysis, you place visuals in the workspace on a sheet. You can imagine this as a sheet from a newspaper, except that it is filled with data visualizations. You can add more sheets, and make them work separately or together in your analysis. The top sheet, also called the default sheet, is the one on the far left. This sheet displays on top in an analysis or dashboard. Each analysis can contain up to 20 sheets. Deleting an analysis 664 Amazon QuickSight User Guide You can share analyses and publish dashboards with multiple sheets. You can also schedule email reports for any combination of sheets in an analysis. When you create a new analysis or a new sheet in an existing analysis, you choose whether to make the new sheet an Interactive sheet or a Paginated report. This way, you can have analyses for interactive sheets only, analyses for paginated reports only, or you can have an analysis that includes both interactive sheets and paginated reports. An Interactive Sheet is a collection of data expressed in visuals that users can interact with when the sheet is published to a dashboard. QuickSight authors can add different controls and filters to their interactive sheets. Dashboard viewers can use these to gain detailed information from the published data. For more information on interactive sheets, see Working with interactive sheets in Amazon QuickSight. A Paginated Report is a collection of tables, charts, and visuals that are used to convey business critical information, such as daily transaction summaries or weekly business reports. In order to create paginated reports in QuickSight, add the Paginated reporting Add-on to your Amazon QuickSight account. To get the Paginated reporting Add-on and start working with paginated reports, see Working with paginated reports in Amazon QuickSight. Use the following list of actions to work with sheets: • To add a new sheet, choose the plus sign (+) to the right of the sheet tabs, choose the type of sheet that you want, and then choose ADD. • To rename a sheet, choose the name of the sheet and start typing. Rename is also available from the sheet menu ( • To duplicate a sheet, choose the name of the sheet, then choose Duplicate from the sheet menu ( You can only duplicate a sheet if Autosave is turned on. • To duplicate an interactive sheet and convert it to a paginated report, choose the name of the sheet, then choose Duplicate to report from the sheet menu. You can't convert a paginated report to an interactive sheet. • To delete a sheet, choose the name of the sheet, then choose Delete from the sheet menu ( You can't delete the sheet if it's the only sheet in the analysis. Adding and managing sheets 665 ). ). ). Amazon QuickSight User Guide • To change the order of the sheets, choose the name of the sheet and drag it to a new position. • To copy a visual to a new sheet, choose Duplicate visual to from the on-visual menu. Then choose the target sheet. Filters exist only on the sheet that you create them on. To duplicate filters, recreate them on the target sheet. •
amazon-quicksight-user-183
amazon-quicksight-user.pdf
183
of the sheet, then choose Delete from the sheet menu ( You can't delete the sheet if it's the only sheet in the analysis. Adding and managing sheets 665 ). ). ). Amazon QuickSight User Guide • To change the order of the sheets, choose the name of the sheet and drag it to a new position. • To copy a visual to a new sheet, choose Duplicate visual to from the on-visual menu. Then choose the target sheet. Filters exist only on the sheet that you create them on. To duplicate filters, recreate them on the target sheet. • To highlight specific data points across visuals in a sheet, go to the Sheets tab and select Layout Settings. Under the Interactivity section, select either On selection or On hover to turn highlighting on, or No highlight to turn it off. By default, sheet highlighting follows the same settings as analysis highlighting. When you select or hover over a data point on a visual, related data across other visuals will stand out, while unrelated data is dimmed. Highlighting allows you to understand correlations, spot patterns, trends, and outliers, and facilitate stronger, more informed analyses. You can use the parameter controls on the top sheet to control multiple sheets. To do this, open each sheet that you want to work with the parameter. Then add a filter that uses the same parameter used in the control on the top sheet. Or, if you want a new sheet to operate independently, you can add parameters and parameter controls to it that are separate from those on the top sheet. Working with interactive sheets in Amazon QuickSight An Interactive Sheet is a collection of data expressed in visuals that users can interact with when the sheet is published to a dashboard. QuickSight authors can add different layouts, controls, and filters to their interactive sheets that dashboard viewers can use to gain detailed information from the published data. By default, every sheet in an analysis is an interactive sheet. If your account doesn't have the Paginated reporting Add-on, you can only create and publish interactive sheets. For more information on creating an interactive sheet, see Starting an analysis in Amazon QuickSight. For more information on formatting interactive sheets, see the following topics. Topics • Customizing dashboard layouts in Amazon QuickSight • Parameters in Amazon QuickSight • Using custom actions for filtering and navigating Working with interactive sheets in Amazon QuickSight 666 Amazon QuickSight User Guide Customizing dashboard layouts in Amazon QuickSight You can customize a dashboard's layout to organize your data to fit your business requirements. You can choose from three dashboard layouts. You can also change the size, background color, border color, and interactions of a visual to create a fully customized dashboard. Use the following topics to learn more about customizing dashboards and visuals. Topics • Types of layout • Choosing a layout • Customizing visuals in a free-form layout • Conditional rules Types of layout There are three dashboard layout designs you can choose from: Tiled, Free-form, and Classic. Tiled layout Visuals in a Tiled layout snap to a grid with standard spacing and alignment. You can make visuals any size and place them wherever you want within a dashboard, but visuals can’t overlap. Customizing dashboard layouts 667 Amazon QuickSight User Guide Dashboards are displayed as designed, with options to fit to screen or view at actual size. You can also fit an entire dashboard to your window by choosing Fit to window for View in the top-right corner. This option was previously called Optimized. Note On mobile devices, tiled layout dashboards appear as a single column in portrait mode or exactly as designed in landscape mode. Free-form layout Visuals in a Free-form layout can be placed anywhere in your dashboard using precise coordinates. You can drag a visual to the exact place you want, or you can enter the coordinates of the visual’s location. Use the following procedure to enter the exact coordinates of the visual's location. Customizing dashboard layouts 668 Amazon QuickSight User Guide Dashboards are displayed the way that you choose to design them, with options to fit to screen or to view at its actual size. You can optimize free-form layouts for viewing at specific resolutions, with the default being 1,600 pixels. You can also fit an entire dashboard to a browser's window by choosing Fit to window for View in the top-right corner. Note Dashboards with optimized resolutions might appear bigger or smaller on a viewer's computer if the viewer's computer resolution doesn't equal the set resolution of the dashboard. Switching from Free-form to another layout might cause some visual elements to shift. On mobile devices, Free-form dashboards appear as published with no changes to the layout. Customizing dashboard layouts 669 Amazon QuickSight Classic layout User
amazon-quicksight-user-184
amazon-quicksight-user.pdf
184
can optimize free-form layouts for viewing at specific resolutions, with the default being 1,600 pixels. You can also fit an entire dashboard to a browser's window by choosing Fit to window for View in the top-right corner. Note Dashboards with optimized resolutions might appear bigger or smaller on a viewer's computer if the viewer's computer resolution doesn't equal the set resolution of the dashboard. Switching from Free-form to another layout might cause some visual elements to shift. On mobile devices, Free-form dashboards appear as published with no changes to the layout. Customizing dashboard layouts 669 Amazon QuickSight Classic layout User Guide Visuals in a Classic layout snap to a grid with standard spacing and alignment. Dashboards hide data or change formatting to fit smaller screen sizes. For example, if you change a visual to make it considerably smaller, the on-visual menu and editors are hidden so that the chart elements have more room to display. Bar chart visuals can also display fewer data points. If you reduce the size of the browser window, Amazon QuickSight resizes and if necessary reorders visuals for optimal display. For example, smaller visuals that were side by side might be displayed sequentially. The original layout is restored when the size of the browser window is increased again. Note On mobile devices, classic layout dashboards appear as a single column or exactly as designed in landscape mode. Choosing a layout To change a dashboard's layout 1. Open the QuickSight console. 2. From the Amazon QuickSight start page, choose Analyses, and then choose the analysis that you want to change. 3. On the analysis page, choose Edit and then choose Analysis Settings. 4. Expand Sheet layout and choose the layout that you want to use. Customizing dashboard layouts 670 Amazon QuickSight User Guide 5. When finished, choose Apply. Customizing visuals in a free-form layout You can use the free-form layout to fully customize the color, size, location, and visibility of each visual in a dashboard. Organizing visuals Besides dragging a visual to its preferred location within a dashboard, there are many different ways to move a visual to the exact location it needs to be. To enter the coordinates of the visual's location 1. Choose the visual that you want. 2. On the menu in the upper-right corner of the visual, select the Format visual icon. Customizing dashboard layouts 671 Amazon QuickSight User Guide 3. In the Properties pane that opens, choose Placement. 4. Enter the X and Y coordinates of the location you want to place your visual. You can also adjust the size of the visual by entering Width and Height values. Selected visuals can also be moved pixel-by-pixel using your keyboard's arrow keys. You can overlay visuals on top of one another to create multi-layered visuals that show data. Customizing dashboard layouts 672 Amazon QuickSight User Guide Visuals can be organized into multiple layers that can be manually moved to the front and back. To move overlaid visuals to the front and back 1. Choose the visual that you want. 2. On the menu in the upper-right hand side of the visual, choose Menu options. 3. For Menu options, choose from the following: • Send to back sends the visual to the back. • Send backward sends the visual one layer back. • Bring forward rings the visual one layer forward. • Bring to front brings a visual to the front. Customizing dashboard layouts 673 Amazon QuickSight User Guide Changing a visual's background color The colors of a visual’s background, border, and selection frame can be customized in the Display settings pane of the Properties pane. To change the color of a visual's background, border, or selection frame 1. Choose the visual that you want to change. 2. On the menu in the upper-right hand side of the visual, choose the Properties icon. 3. In the Properties pane that appears on the left, choose Display settings. 4. Navigate to the Card style section and perform one or more of the available actions: • To change the color of a visual's background, choose the Background color box, and then choose the color that you want. • To change the color of a visual's border, choose the Border color box, and then choose the color that you want. • To change the color of a visual's selection frame, choose the Selection color box, and then choose the color that you want. The image below shows the Card style section of the Display settings menu. Customizing dashboard layouts 674 Amazon QuickSight User Guide If you want to use a custom color for your visual's background, border, or selection frame, choose the color box of the property that you want to change, and then choose Custom color. In the Custom color window that appears, choose your custom color
amazon-quicksight-user-185
amazon-quicksight-user.pdf
185
the Border color box, and then choose the color that you want. • To change the color of a visual's selection frame, choose the Selection color box, and then choose the color that you want. The image below shows the Card style section of the Display settings menu. Customizing dashboard layouts 674 Amazon QuickSight User Guide If you want to use a custom color for your visual's background, border, or selection frame, choose the color box of the property that you want to change, and then choose Custom color. In the Custom color window that appears, choose your custom color or enter the color's hexadecimal code. When you are finished, choose Apply. You can also reset a visual's customized background back to its default appearance. To reset the appearance of a visual 1. Choose the visual that you want to change. 2. On the menu in the upper-right hand side of the visual, choose the Properties icon. 3. In the Properties pane that appears on the left, choose Display settings. 4. Choose the color that you want to reset, and then choose Reset to default. Hiding visual backgrounds, borders, and selection colors You can also choose not to show the background border, or selection color of a visual. This is useful for when you want to overlap multiple visuals. You can hide a visual’s background, border, and selection colors by choosing the eye icon next to the Border, Background, or Selection color boxes. You can also remove a visual’s loading animation by clearing the Show loading animation box. The image below shows the hide visual icon. Disabling visual menus Use the Interactions panel of the Properties pane to hide the Context menu and On-visual menu from selected visuals. You can hide secondary visual menus to make the visual less crowded or to make a visual act like an overlay. Customizing dashboard layouts 675 Amazon QuickSight User Guide The Context menu opens on data-point clicks. Common actions in the Context menu include Focus, Exclude, and Drill-down. The On-visual menu appears on the top-right side of a visual. The On-visual menu is used to access the Proeprties pane, Maximize the visual, access the Menu options panel, and review an Anomaly insight. You can turn off the secondary visual menus by clearing the Context menu and On-visual menu options. Note You can't preview changes to the Interactions panel in Analyses. Publish the dashboard to view your changes. Customizing dashboard layouts 676 Amazon QuickSight User Guide Conditional rules This feature is currently available with the Free-form layout. Conditional rules are used to hide or show visuals when specific conditions are met. This can be useful when you have multiple versions of the same visual overlapped with each other and want the dashboard viewer to see a version that best represents the parameter value they select. Conditional rules use parameters and parameter controls to hide and show visuals. Parameters are named variables that can transfer a value for use by an action or an object. This feature supports string and number parameters. To make the parameters accessible to the dashboard viewer, you add a parameter control. A parameter control allows users to choose a value to use in a predefined filter or URL action. For more information about parameters and parameter controls, see Parameters in Amazon QuickSight. Use the sections below to set up and use conditional rules. Topics • Hiding a visual by default • Setting a conditional rule • Using conditional rules Customizing dashboard layouts 677 Amazon QuickSight Hiding a visual by default User Guide In the Interactions pane of the Properties pane, you can choose to hide a visual by default. Doing this can be useful if you want the viewer to only see visuals based on specific conditions. To hide a visual by default 1. From the QuickStart start page, choose Analyses, and then choose the analysis that you want to customize. 2. Choose the visual that you want to add a rule to. 3. On the menu in the upper-right hand side of the visual, choose Properties. 4. 5. In the Properties pane that opens, choose Interactions and open the Rules dropdown. In the Rules menu, choose Hide this visual by default. Hidden visuals appear fully hidden in a viewing dashboard. In the Analyses pane, hidden visuals are visible with the message “Hidden based on rule”. With this display, you can see where all of a dashboard's visuals are located. Note You can't create conditional rules that hide visuals that are already hidden by default or that show visuals that already appear by default. If you change the default appearance of a visual, existing rules that contradict the new default appearance will be disabled. Customizing dashboard layouts 678 Amazon QuickSight Setting a conditional rule User Guide When you set up
amazon-quicksight-user-186
amazon-quicksight-user.pdf
186
by default. Hidden visuals appear fully hidden in a viewing dashboard. In the Analyses pane, hidden visuals are visible with the message “Hidden based on rule”. With this display, you can see where all of a dashboard's visuals are located. Note You can't create conditional rules that hide visuals that are already hidden by default or that show visuals that already appear by default. If you change the default appearance of a visual, existing rules that contradict the new default appearance will be disabled. Customizing dashboard layouts 678 Amazon QuickSight Setting a conditional rule User Guide When you set up a conditional rule, you create a conditional statement that will hide or show a visual when a specific condition is met. You can currently create conditional rules that hide or show a visual. If you want to create a conditional rule that makes a hidden visual appear, choose Hide this visual by default in the Rules menu of the Properties pane. Note Before you begin, make a parameter and a corresponding parameter control to base your new conditional rule on. Supported parameters are string parameters and number parameters. For more information about parameters and parameter controls, see Parameters in Amazon QuickSight. To set a conditional rule 1. From the Amazon QuickSight start page, choose Analyses, and then choose the analysis you want to customize. 2. Choose the visual that you want to add a rule to. 3. On the menu in the upper-right hand side of the visual, choose Properties. 4. In the Properties pane that appears on the left, choose Interactions, and then choose Rules. 5. Choose ADD RULE. 6. 7. In the first menu in the Add rule pane, choose the parameter you want. In the second menu in the Add rule pane, choose which condition you want. For string parameters, supported conditions are Equals, Starts with, Contains, and Does not equal. For number parameters, supported conditions are Equals, Starts with, Contains, and Does not equal. 8. Enter the value you want the conditional rule to meet. Note Values are case-sensitive. 9. Choose Add rule to apply the new conditional rule to the visual. To cancel the rule, choose Cancel. Customizing dashboard layouts 679 Amazon QuickSight User Guide Conditional rules can also be edited and deleted. To edit a conditional rule 1. On the menu in the upper-right hand side of the visual, choose Properties. 2. In the Properties pane that appears on the left, choose Interactions, and then choose Rules. 3. Choose the menu icon on the right-hand side of the rule you want to edit, and choose Edit. 4. Make the changes that you want and choose Save. To delete a conditional rule 1. On the menu in the upper-right hand side of the visual, choose Properties. 2. In the Properties pane that appears on the left, choose Interactions, and then choose Rules. 3. Choose the menu icon on the right-hand side of the rule you want to edit and choose Delete. Using conditional rules Once you have set up a conditional rule that is connected to a parameter and a parameter control, you can use the parameter control to enable or disable the conditional rules you have set. Customizing dashboard layouts 680 Amazon QuickSight To enable a conditional rule User Guide 1. From the QuickStart start page, choose Analyses, and then choose the analysis you want to customize. 2. On the Controls bar at the top of your workspace, choose the dropdown icon. 3. Choose the parameter control associated with the conditional rule you created. 4. Choose the value associated with the conditional rule that you created from the parameter's menu. You can also enter the value that you want into the Search value box. Note Values are case-sensitive. Selecting the correct value causes the visual to appear or disappear depending on the rule you set. Customizing dashboard layouts 681 Amazon QuickSight User Guide You can also bring a parameter control to the sheet your visual is on. This is useful when you want a parameter control to be next to the visual it is associated with or when you want to add a conditional rule to the control so it appears only when specific conditions are met. To bring a parameter control to a sheet 1. From the QuickStart start page, choose Analyses, and then choose the analysis you want to customize. 2. On the Controls bar at the top of your workspace, choose the control that you want to move. 3. At the upper right-hand side of the control, open the Menu options menu. Customizing dashboard layouts 682 Amazon QuickSight 4. Choose Move to sheet. User Guide To move a parameter control back to the Controls bar 1. On your dashboard, select the parameter control you want to move. 2. On the upper
amazon-quicksight-user-187
amazon-quicksight-user.pdf
187
conditions are met. To bring a parameter control to a sheet 1. From the QuickStart start page, choose Analyses, and then choose the analysis you want to customize. 2. On the Controls bar at the top of your workspace, choose the control that you want to move. 3. At the upper right-hand side of the control, open the Menu options menu. Customizing dashboard layouts 682 Amazon QuickSight 4. Choose Move to sheet. User Guide To move a parameter control back to the Controls bar 1. On your dashboard, select the parameter control you want to move. 2. On the upper right-hand side of the control, open the Menu options menu. 3. Choose Move to top of sheet. Parameters in Amazon QuickSight Parameters are named variables that can transfer a value for use by an action or an object. By using parameters, you can create an easier way for a dashboard user to interact with dashboard features in a less technical way. Parameters can also connect one dashboard to another, allowing a dashboard user to drill down into data that's in a different analysis. For example, a dashboard user can use a list to choose a value. That value sets a parameter that in turn sets a filter, calculation, or URL action to the chosen value. Then the visuals in the dashboard react to the user's choices. To make the parameters accessible to the dashboard viewer, you add a parameter control. You can set up cascading controls, so that a selection in one control filters the options that display in another control. A control can appear as a list of options, a slider, or a text entry area. If you don't create a control, you can still pass a value to your parameter in the dashboard URL. Parameters 683 Amazon QuickSight User Guide For a parameter to work, it needs to be connected to something in your analysis, regardless of whether it has a related control. You can reference parameters in the following: • Calculated fields (except for multivalue parameters) • Filters • Dashboard and analysis URLs • Actions • Titles and descriptions throughout an analysis Some ways that you can use parameters are the following: • Using a calculation, you can transform data that is shown in an analysis. • If you add a control with a filter to an analysis you are publishing, the dashboard users can filter the data without creating their own filters. • Using controls and custom actions, you can let dashboard users set values for the URL actions. Topics • Setting up parameters in Amazon QuickSight • Using a control with a parameter in Amazon QuickSight • Creating parameter defaults in Amazon QuickSight • Connecting to parameters in Amazon QuickSight Setting up parameters in Amazon QuickSight Use the following procedure to create or edit a basic parameter. To create or edit a basic parameter 1. Choose an analysis to work with, then decide which field you want to parameterize. 2. Choose the Parameters icon from the icon list at the top of the page. Parameters 684 Amazon QuickSight User Guide 3. Add a new parameter by choosing the plus sign (+ Add) near the top of the pane. Edit an existing parameter by first choosing the v-shaped icon near the parameter name and then choosing Edit parameter. For Name, enter an alphanumeric value for the parameter. For Data type, choose String, Number, Integer, or Datetime, and then complete the following steps. 4. 5. • If you choose String, Number, or Integer, do the following: 1. For Values, choose Single value or Multiple values. Choose the single value option for parameters that can contain only one value. Choose multiple values for parameters that can contain one or more values. Multivalue parameters can't be datetime data types. They also don't support dynamic default values. To switch an existing parameter between single and multiple values, delete and recreate the parameter. 2. (Optional) For Static default value or Static multiple default values, enter one or more values. This type of static value is used during the first page load if a dynamic default value or URL parameter isn't provided. 3. (Optional) Choose Show as blank by default. Parameters 685 Amazon QuickSight User Guide Select this option to show the default value for multivalue lists as blank. This option only applies to multivalue parameters. • If you choose Datetime, do the following: 1. For Time granularity, choose Day, Hour, Minute, or Second. 2. For Default date, select either Fixed date or Relative date, and then do the following: • If you select Fixed date, enter a date and time by using the date and time picker. • If you select Relative date, choose a rolling date. You can choose Today, Yesterday, or you can specify the Filter condition (start of
amazon-quicksight-user-188
amazon-quicksight-user.pdf
188
Amazon QuickSight User Guide Select this option to show the default value for multivalue lists as blank. This option only applies to multivalue parameters. • If you choose Datetime, do the following: 1. For Time granularity, choose Day, Hour, Minute, or Second. 2. For Default date, select either Fixed date or Relative date, and then do the following: • If you select Fixed date, enter a date and time by using the date and time picker. • If you select Relative date, choose a rolling date. You can choose Today, Yesterday, or you can specify the Filter condition (start of or end of), Range (this, previous, or next), and Period (year, quarter, month, week, or day). 6. (Optional) Choose Set a dynamic default to create a default that is user-specific. A dynamic default is a per-user default value for the first page load of the dashboard. Use a dynamic default to create a personalized view for each user. Calculated fields can't be used as dynamic defaults. Dynamic defaults don't prevent a user from selecting a different value. If you want to secure the data, you can add row-level locking. For more information, see Using row-level security with user-based rules to restrict access to a dataset. This option only appears if you choose a single value parameter. Multivalue parameters can't have dynamic defaults. Note If you choose a multivalue parameter, the screen changes to remove the default options. Instead, you see a box with the text Enter values you want to use for this Parameters 686 Amazon QuickSight User Guide control. You can enter multiple values in this box, each on a single line. These values are used as the default selected values in the parameter control. The values here are unioned with what you choose to enter for the parameter control. For more information on parameter controls, see Parameter Controls. 7. (Optional) Set a reserved value to determine the value of the Select all value. The reserved value of a parameter is the value that is assigned to a parameter when you choose Select all as its value. When you set up a specific reserved value for your parameter, that value is no longer considered a valid parameter value in your dataset. The reserved value can't be used in any parameter consumers, such as filters, controls, and calculated fields, and custom actions. Also, it does not appear in the parameter control list. You can choose from Recommended value, Null, and Custom value. Recommended value is the default. If you choose Recommended value, the reserved value is set to the following values based on the value type: • Strings: "ALL_VALUES" • Numbers: "Long.MIN_VALUE"-9,223,372,036,854,775,808 • "Integers: Int.MIN_VALUE"-2147483648 To set a reserved value in your new parameter, choose the Advanced settings dropdown list in either the Create a new parameter page or the Edit parameter page and select the value that you want. 8. Choose Create or Update to complete creating or updating the parameter. After you create a parameter, you can use it in a variety of ways. You can create a control (such as a button) so that you can choose a value for your parameter. For more information, see the following sections. Using a control with a parameter in Amazon QuickSight In dashboards, parameter controls appear at the top of the data sheet, which contains a set of visuals. Providing a control allows users to choose a value to use in a predefined filter or URL action. Dashboard users can use controls to apply filtering across all visuals datasets on a dashboard, without having to create the filters themselves. The following rules apply: • To create or edit a control for a parameter, make sure that the parameter exists. Parameters 687 Amazon QuickSight User Guide • Multiselect list controls are compatible with analysis URLs, dashboard URLs, custom actions, and custom filters. The filter must be either equal or not equal to the values provided. No other comparisons are supported. • Lists show up to 1,000 values. If there are more than 1,000 distinct values, a search box appears so you can filter the list. When the filtered list contains less than 1,001 values, the contents of the list appear as line items. • The Style option displays only the style types that are appropriate for the parameter's data type and single or multivalue setting. If the style that you want to use isn't in the list, recreate your parameter with the appropriate settings and try again. • If your parameter links to a dataset field, it must be an actual field. Calculated fields aren't supported. • The values display alphabetically in the control, unless there are more than 1,000 distinct values. Then the control displays a search box instead. Each time you search for the value you want to use,
amazon-quicksight-user-189
amazon-quicksight-user.pdf
189
line items. • The Style option displays only the style types that are appropriate for the parameter's data type and single or multivalue setting. If the style that you want to use isn't in the list, recreate your parameter with the appropriate settings and try again. • If your parameter links to a dataset field, it must be an actual field. Calculated fields aren't supported. • The values display alphabetically in the control, unless there are more than 1,000 distinct values. Then the control displays a search box instead. Each time you search for the value you want to use, it initiates a new query. If the results contain more than 1,000 values, you can scroll through the values with pagination. Wildcard search is supported. To learn more about wildcard search, see Using wildcard search. Use the following procedure to create or edit a control for an existing parameter. To create or edit a control for an existing parameter 1. Choose an existing parameter's context menu, the v icon near the parameter name, and choose Add control. 2. Enter a name to give the new control a label. This label appears at the top of the workspace, and later at the top of the sheet that a dashboard displays on. 3. Choose a style for the control from the following: • Text field A text field lets you type in their own value. A text field works with numbers and text (strings). • Text field - multiline A multiline text field lets you type in their own values. With this option, you can choose to separate values you enter into the parameter control by a line break, comma, pipe (|), or semicolon. A text field works with numbers and text (strings). Parameters 688 Amazon QuickSight • Dropdown User Guide A dropdown list control that you can use to select a single value. A list control works with numbers and text (strings). • Dropdown multiselect A list control that you can use to select multiple values. A list control works with numbers and text (strings). • List A list control that you can use to select a single value. A list control works with numbers and text (strings). • List - multiselect A list control that you can use to select multiple values. A list control works with numbers and text (strings). • Slider A slider lets you select a numeric value by sliding the control from one end of the bar to another. A slider works with numbers. • Date-picker Using a date-picker, you can choose a date from a calendar control. When you choose to add a date-picker control, you can customize how to format dates in the control. To do so, for Date format, enter the date format that you want using the tokens described in Customizing date formats in Amazon QuickSight. 4. (Optional) If you choose a dropdown control, the screen expands so you can choose the values to display. You can either specify a list of values, or use a field in a dataset. Choose one of the following: • Specific values To create a list of specific values, type in one per line, with no separating spaces or commas, as shown in the following screenshot. In the control, the values display alphabetically, not in the order that you typed them. • Link to a data set field Parameters 689 Amazon QuickSight User Guide To link to a field, choose the dataset that contains your field, then choose the field from the list. If you change the default values in the parameter, choose Reset on the control to show the new values. The values that you choose here are unioned with the static default values in the parameter settings. 5. (Optional) Enable the option Hide [ALL] option from the control if the parameter has a default configured. Doing this shows only the data values and removes the option to select all items in the control. If you don't configure a static default on the parameter, this option doesn't work. You can add a default after adding a control by choosing the parameter, and selecting Edit parameter. 6. (Optional) You can limit the values displayed in the controls, so they only show values that are valid for what is selected in other controls. This is called a cascading control. To create one, choose Show relevant values only. Choose one or more controls that can change what displays in this control. When creating cascading controls, the following limitations apply. • Cascading controls must be tied to dataset columns from the same dataset. • The child control must be a dropdown or list control. • For parameter controls, the child control must be linked to a dataset column. • For filter controls, the child control must be linked to
amazon-quicksight-user-190
amazon-quicksight-user.pdf
190
controls, so they only show values that are valid for what is selected in other controls. This is called a cascading control. To create one, choose Show relevant values only. Choose one or more controls that can change what displays in this control. When creating cascading controls, the following limitations apply. • Cascading controls must be tied to dataset columns from the same dataset. • The child control must be a dropdown or list control. • For parameter controls, the child control must be linked to a dataset column. • For filter controls, the child control must be linked to a filter (instead of showing only specific values). • The parent control must be one of the following. • A string, integer, or numeric parameter control. • A string filter control (EXCLUDING Top-Bottom filters). • A non-aggregated numeric filter control. • A date filter control (EXCLUDING Top-Bottom filters). 7. When you finish choosing options for your control, choose Add. Parameters 690 Amazon QuickSight User Guide The finished control appears at the top of the workspace. The context menu, shaped like a v, offers four options: • Reset restores the user's selection to its default state. • Refresh list applies only to drop-downs that are linked to a field in a dataset. Choosing Refresh list queries the data to check for changes. Data used in the control is cached. • Edit reopens the control creation screen so that you can change your settings. Once you have the Edit control pane open, you can click on different visuals and controls to view formatting data for the specific visual or control. For more information about formatting a visual, see Formatting in Amazon QuickSight. • Delete removes the control. You can recreate it by choosing the parameter context menu. In the workspace, you can also resize and rearrange your controls. The dashboard users see them as you do, except without being able to edit or delete them. Creating parameter defaults in Amazon QuickSight Use this section to learn more about the types of parameter defaults that are available, and how to set up each of them. Each field can have a parameter and a control associated with it. When someone views a dashboard or email report, any sheet control that has a static default value configured uses the static default. The default value can change how data is filtered, how custom actions behave, and what text displays in a dynamic sheet title. Email reports also support dynamic defaults. The simplest default is a static (unchanging) default, which shows the same value to everyone. As the designer of the dashboard, you choose the default value. It can't be changed by the person using the dashboard. However, that person can choose any value from the controls. Setting a default doesn't change this. To restrict the values that a person can select, consider using row-level security. For more information, see Using row-level security with user-based rules to restrict access to a dataset. To create or edit a static default value that applies to everyone's dashboard view 1. Choose the context menu (v) by the parameter that you want to edit, or create a new parameter by following the steps in Setting up parameters in Amazon QuickSight. 2. Enter a value for Static default value to set a static default. Parameters 691 Amazon QuickSight User Guide To display a different default depending on who is viewing the dashboard, you create a dynamic default parameter (DDP). Using dynamic defaults involves some preparation to map people to their assigned defaults. First, you need to create a database query or a data file that contains information about the people, the fields, and the default values to display. You add this to a dataset, then add the dataset to your analysis. Following, you can find procedures that you can use to gather information, create the dataset, and add the dynamic default to the parameter. Use the following guidelines when creating a dataset for dynamic default values: • We recommend that you use a single dataset to contain all dynamic default definitions for a logical grouping of users or groups. If you can, maintain them in a single table or file. • We also recommend that the fields in your dataset have names that closely match the field names in the analysis. Not all dataset fields need to be part of the analysis, for example if you're using the same dataset for the defaults in multiple dashboards. The fields can be in any order. • We don't recommend that you combine both user and group names in the same column or even in the same dataset. This kind of configuration is more work to maintain and troubleshoot. • If you use a comma-delimited file to create your dataset, make sure to remove any
amazon-quicksight-user-191
amazon-quicksight-user.pdf
191
also recommend that the fields in your dataset have names that closely match the field names in the analysis. Not all dataset fields need to be part of the analysis, for example if you're using the same dataset for the defaults in multiple dashboards. The fields can be in any order. • We don't recommend that you combine both user and group names in the same column or even in the same dataset. This kind of configuration is more work to maintain and troubleshoot. • If you use a comma-delimited file to create your dataset, make sure to remove any space between values in the file. The following example shows the correct comma-separated value (CSV) format. Enclose text (strings) that include nonalphanumeric characters—like spaces, apostrophes, and so on—in single or double quotation marks. You can enclose fields that are dates or times in quotation marks, but it isn't required. You can enclose numeric fields in quotation marks, for example if the numbers contain special characters, as shown following. "Value includes spaces","Field contains ' other characters",12345.6789,"20200808" ValueWithoutSpaces,"1000,67","Value 3",2020-AUG-08 • After you create the dataset, make sure to double-check the data types that QuickSight selects for the fields. Before you begin, you need a list of the user or group names for the people who are going to have dynamic defaults. To generate a list of users or groups, you can use the AWS CLI to get the information. To run CLI commands, make sure that you have the AWS CLI installed and configured. For more information, see Installing the AWS CLI in the AWS CLI User Guide. This is just one example of how to get a list of user or group names. Use whatever method works best for you. Parameters 692 Amazon QuickSight User Guide To identify people for a dynamic default parameter (DDP) • List either individual user names or group names: • To list individual user names, include a column that identifies the people for your DDP. This column should contain each person's system user name that they use to connect from your identity provider to QuickSight. This user name is often the same as a person's email alias before the @ sign, but not always. To get a list of users, use the ListUsers QuickSight API operation or AWS CLI command. The CLI command is shown in the following example. Specify the AWS Region for your identity provider, for example us-east-1. awsacct1="111111111111" namespace="default" region="us-east-1" aws quicksight list-users --aws-account-id $awsacct1 --namespace $namespace -- region $region The following example alters the previous command by adding a query that limits the results to active users. awsacct1="111111111111" namespace="default" region="us-east-1" aws quicksight list-users --aws-account-id $awsacct1 --namespace $namespace -- region $region --query 'UserList[?Active==`true`]' The result set looks similar to the following sample. This example is an excerpt from JSON output (--output json). People who have federated user names have principal IDs that start with the word federated. [ { "Arn": "arn:aws:quicksight:us-east-1:111111111111:user/default/ anacasilva", "UserName": "anacarolinasilva", "Email": "anacasilva@example.com", Parameters 693 Amazon QuickSight User Guide "Role": "ADMIN", "Active": true, "PrincipalId": "federated/iam/AIDAJ64EIEIOPX5CEIEIO" }, { "Arn": "arn:aws:quicksight:us-east-1:111111111111:user/default/Reader/ liujie-stargate", "UserName": "Reader/liujie-stargate", "Role": "READER", "Active": true, "PrincipalId": "federated/iam/AROAIJSEIEIOMXTZEIEIO:liujie-stargate" }, { "Arn": "arn:aws:quicksight:us-east-1:111111111111:user/default/embedding/ cxoportal", "UserName": "embedding/cxoportal", "Email": "saanvisarkar@example.com", "Role": "AUTHOR", "Active": true, "PrincipalId": "federated/iam/AROAJTGEIEIOWB6BEIEIO:cxoportal" }, { "Arn": "arn:aws:quicksight:us-east-1:111111111111:user/default/ zhangwei@example.com", "UserName": "zhangwei@example.com", "Email": "zhangwei@example.com", "Role": "AUTHOR", "Active": true, "PrincipalId": "user/d-96123-example-id-1123" } ] • To list group names, include a column that identifies the groups containing the user names for your DDP. This column should contain the system group names that are used to connect from your identity provider to QuickSight. To identify groups that you can add to the dataset, use one or more of the following QuickSight API operations or CLI commands: • ListGroups – Lists QuickSight groups by AWS account ID and namespace for the AWS Region that contains your identity provider. • ListGroupMemberships – Lists the users in the specified QuickSight group. • ListUserGroups – Lists the QuickSight groups that a QuickSight user is a member of. Parameters 694 Amazon QuickSight User Guide Or you can ask your network administrator to query your identity provider to get this information. The next two procedures provide instructions on how to finish creating a dataset for dynamic default values. The first procedure is for creating a dataset for a single-value DDP. The second one is for creating a dataset for a multivalue DDP. To create a dataset for a single-value DDP 1. Create dataset columns with single-value parameters. The first column in the query or file should be for the people using the dashboard. This field can contain user names or group names. However, support for groups is only available in QuickSight Enterprise edition. 2. For each field that displays a dynamic default for a single-value parameter, add a column to the dataset. The name of the column doesn't matter—you can use
amazon-quicksight-user-192
amazon-quicksight-user.pdf
192
is for creating a dataset for a single-value DDP. The second one is for creating a dataset for a multivalue DDP. To create a dataset for a single-value DDP 1. Create dataset columns with single-value parameters. The first column in the query or file should be for the people using the dashboard. This field can contain user names or group names. However, support for groups is only available in QuickSight Enterprise edition. 2. For each field that displays a dynamic default for a single-value parameter, add a column to the dataset. The name of the column doesn't matter—you can use the same name as the field or parameter. Single-value parameters only work as specified if the combination of user entity and dynamic default is unique for that parameter's field. If there are multiple values a default field for a user entity, the single-value control for that field displays the static default instead. If no static default is defined, the control doesn't display a default value. Be careful if you use group names, because some user names can be members of multiple groups. If those groups have different default values, then this type of user name functions as a duplicate entry. The following example shows a table that appears to contain two single-value parameters. We make this assumption because no user name is paired with multiple default values. To make this table easier to understand, we add the word 'default' in front of the field names from the analysis. Thus, you can read the table by making the following statement, changing the values for each row: When viewed by anacarolinasilva, the controls display a default region NorthEast and a default segment SMB. Viewed-by Default-region Default-segment anacarolinasilva NorthEast liujie SouthEast saanvisarkar NorthCentral SMB SMB SMB Parameters 695 Amazon QuickSight Viewed-by zhangwei Default-region Default-segment SouthCentral SMB User Guide 3. 4. Import this data into QuickSight, and save it as a new dataset. In your analysis, add the dataset that you created. The analysis needs to use at least one other dataset that matches the columns you defined for the defaults. For more information, see Adding a dataset to an analysis. To create a dataset for a multivalue DDP 1. Create dataset columns with multivalue parameters. The first column in the query or file should be for the people using the dashboard. This field can contain user names or group names. However, support for groups is only available in QuickSight Enterprise edition. 2. For each field that displays a dynamic default for a multivalue parameter, add a column to the dataset. The name of the column doesn't matter—you can use the same name as the field or parameter. Unlike single-value parameters, multivalue parameters allow multiple values in the field that's associated with the parameter. The following example shows a table that appears to contain a single-value parameter and a multivalue parameter. We can make this assumption because each user name has a unique value in one column, and some user names have multiple values in the other column. To make this table easier to understand, we add the word 'default' in front of the field names from the analysis. Thus, you can read the table by making the following statement, changing the values for each row: When viewed-by is liujie, the controls display a default-region value of SouthEast, and a default-city value of Atlanta. And if we read ahead one row, we see that liujie also has Raleigh in default-city. Viewed-by Default-region Default-city anacarolinasilva NorthEast New York liujie liujie Parameters SouthEast SouthEast Atlanta Raleigh 696 Amazon QuickSight User Guide Viewed-by Default-region Default-city saanvisarkar NorthCentral zhangwei zhangwei SouthCentral SouthCentral Kansas City Chicago Dallas In this example, the parameter that we apply default-region to works correctly whether it's a single-value or multivalue parameter. If it's a single-value parameter, two entries work for one user because both entries are the same value, SouthEast. If it's a multivalue parameter, it still works, except that only one value is selected by default. However, if we change the parameter that's using default-city as its default from a multivalue to a single-value parameter, we don't see these defaults selected. Instead, the parameter uses the static default, if there is one defined. For example, if the static default is set to Atlanta, liujie has Atlanta selected in that control, but not Raleigh. In some cases, your static default value might also be used as a dynamic default. If so, make sure to test the control for a user name that doesn't use a default value that can be both. 3. 4. If a user name belongs to multiple groups, the named user sees a set of default values that is a union of the two groups' default values. Import this data into QuickSight, and save it as a new dataset. In your