Site icon i2tutorials

Amazon QuickSight – medianIf

Amazon QuickSight – medianIf

 

The ‘medianIf’ function in Amazon QuickSight is used to compute the median value of a measure, subject to a specified condition.

 

Syntax

#Start#
medianIf(measure, condition)
#End#

 

This function takes two arguments:

 

 

Suppose we have a dataset that contains information about test scores for students and we want to find the median score for students who scored above 80. We can use the medianIf() function in Amazon QuickSight to do this.

 

To find the median score for students who scored above 80, we can create a new visual in Amazon QuickSight and add a table with the following settings:

 

This will result in a table that shows the median test score for students who scored above 80.

 

Alternatively, we can create a calculated field in Amazon QuickSight with the following expression:

 

Example

#Start#
medianIf(TestScore, TestScore > 80)
#End#

 

This expression will compute the median test score for students who scored above 80.

 

For instance, if our test score data is as follows:

Student IDTest Score
185
292
376
488
590
682

 

Then, the median test score for students who scored above 80 will be:

 

Example

#Start#
medianIf(TestScore, TestScore > 80) = 85
#End#

 

In this example, we can see that the medianIf() function has computed the median test score for students who scored above 80, resulting in a useful metric that can inform our educational decisions.

 

Exit mobile version