How can I calculate the median of sales price using 3 variables in Tableau

0 votes

Data

Type             Borough       ListPrice
RentalType1      Manhattan       $5,000
RentalType2      Bronx           $3,000
RentalType2      Brooklyn        $3,000
SalesType2       Manhattan       $900,000
SalesType1       Brooklyn        $100,000
SalesType1       Bronx           $500,000
SalesType2       Queens          $800,000
SalesType2       Staten Island   $400,000

What I actually want.

I want to calculate the median of sales price and the median rental price for an apartment in NYC( each of the 5 boroughs, Brooklyn, Bronx Manhattan, Queens and Staten Island).

In Tableau the sales and and rentals are groups of ListPrice -- Variables ListPrice is NUMBER(decimal) Type (includes Sales & Rentals, Borough

Any help is appreciated

What I already tried?

I tried creating a calculated field but I guess that somehow did not worked for me. Following is what I tried in the calculated :

WINDOW_MEDIAN(SUM([ListPrice])-1, -1)  

ERROR: WINDOW_MEDIAN is being called with (float, integer), did mean 
(float,integer,integer) 
Apr 12, 2018 in Tableau by Atul
• 10,240 points
6,974 views

1 answer to this question.

0 votes

First let me clarify things for you. Your table calculation takes 3 arguments: Expression, First row and last row of the partition and what you did that, in your formula you haven't given last row of the partition.

You must run the function for type in each Borough and then calculate for each Borough.

So this is how your formula should look like:

WINDOW_MEDIAN(SUM(INT([List Price])),FIRST(),LAST())

enter image description here

Here calculation2 is median value

enter image description here

answered Apr 12, 2018 by xyz
• 1,560 points

Related Questions In Tableau

0 votes
1 answer

How can I count the aggregate function in Tableau

Create two calculated fields one for 100's ...READ MORE

answered Apr 6, 2018 in Tableau by Atul
• 10,240 points
5,607 views
0 votes
0 answers

How can I sort date field in presence of another date field in Tableau?

Goal: Sort the new ship date in ...READ MORE

Apr 10, 2018 in Tableau by ghost
• 1,790 points
1,352 views
0 votes
2 answers

How can I add text in the centre of a Donut Chart ?

Hi, You can read this for creating a donut ...READ MORE

answered Apr 4, 2019 in Tableau by Cherukuri
• 33,030 points
12,053 views
0 votes
1 answer

How to calculate the percent of records within a group in tableau?

 You can click the measure SUM(Number of Records) and ...READ MORE

answered May 9, 2018 in Tableau by ffdfd
• 5,550 points
4,764 views
0 votes
1 answer

How to color code cells of a column based on the text value in Tableau

You can use the following steps to ...READ MORE

answered Mar 27, 2018 in Tableau by Atul
• 10,240 points
9,832 views
+2 votes
1 answer
0 votes
1 answer

Calculated filed with if-then

Below is the required code:  IF (NOT ISNULL([test2])) ...READ MORE

answered Mar 27, 2018 in Tableau by Atul
• 10,240 points
1,561 views
+2 votes
1 answer
0 votes
1 answer

How can I filter my data to see the results for 8 days ago?

Hey try these steps and let me ...READ MORE

answered Sep 5, 2018 in Tableau by xyz
• 1,560 points
676 views
0 votes
1 answer

How to group bins in a tableau histogram?

One of the simple way is by ...READ MORE

answered Apr 3, 2018 in Tableau by xyz
• 1,560 points
6,803 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP