Site icon i2tutorials

Amazon QuickSight – periodToDateMedian

Amazon QuickSight – periodToDateMedian

 

The ‘periodToDateMedian()’ function in QuickSight is used to calculate the median of a given measure over a specified period up to a specified date.

 

Syntax

#Start#
periodToDateMedian(measure, dateTime, period, endDate)
#End#

 

This function takes the following arguments:

 

 

Suppose you have a sales dataset with the following columns: “Order Date”, “Product Category”, “Sales Amount”. You want to calculate the median sales amount for the “Electronics” category for the current year up to today’s date. You can use the periodToDateMedian() function as follows:

 

Example

#Start#
periodToDateMedian(Sales Amount, "Order Date", "year")
#End#

 

This will calculate the median sales amount for the “Electronics” category for the current year up to today’s date. If you want to specify a different end date, you can add the endDate parameter:

 

Example

#Start#
periodToDateMedian(Sales Amount, "Order Date", "year", "2022-03-15")
#End#

 

This will calculate the median sales amount for the “Electronics” category for the 2022 calendar year up to March 15th, 2022.

 

Exit mobile version