Amazon QuickSight – periodToDateStDevP
The ‘periodToDateStDevP()’ function in Amazon QuickSight is a statistical function that calculates the population standard deviation of a measure for a given time period. This function is similar to the periodToDateStDev() function, but it uses a slightly different formula that assumes the entire population is being analyzed, rather than a sample.
Syntax
#Start# periodToDateStDevP( measure, dateTime, period, endDate (optional) ) #End#
This function takes the following arguments:
- measure: This parameter specifies the measure for which you want to calculate the population standard deviation. The measure can be a field or an expression.
- dateTime: This parameter specifies the date and time for which you want to calculate the population standard deviation. The parameter should be in the timestamp format.
- period: This parameter specifies the time period for which you want to calculate the population standard deviation. The valid values for the period parameter are hour, day, week, month, quarter, and year.
- endDate (optional): This parameter specifies the end date and time of the time period. If this parameter is not specified, the current date and time will be used as the end date.
Suppose you have a sales dataset with the following fields: Date, Product, Sales, and Region. You can use the periodToDateStDevP() function to calculate the population standard deviation of sales for the current week by region. Here’s an example formula:
Example
#Start# periodToDateStDevP(Sales, Date, 'week', now(), Region) #End#
This formula calculates the population standard deviation of the Sales field for the current week, grouped by Region. The now() function is used to specify the current date and time as the end date. This function can help you identify the level of variability of sales for the week in each region, assuming that the entire population of sales is being analyzed. Note that if you are working with a sample of the data, the periodToDateStDev() function may be more appropriate for calculating the standard deviation.