
1. Re: Calculating Mean and Median from "Number of Rows"
Hari Ankem Oct 9, 2017 10:07 PM (in response to Mustafa Mushtaq)You need to provide a packaged workbook so that someone can provide a relevant solution.

2. Re: Calculating Mean and Median from "Number of Rows"
Mustafa Mushtaq Oct 10, 2017 11:05 AM (in response to Hari Ankem)The file is attached. Any help is appreciated.

Tab Community.twbx 453.6 KB


3. Re: Calculating Mean and Median from "Number of Rows"
Hari Ankem Oct 10, 2017 11:46 AM (in response to Mustafa Mushtaq)You need to convert the datetime to a numeric value and do the required operations on it as shown below:
Refer attached workbook. Hope this helps.

Tab Community.twbx 480.0 KB


4. Re: Calculating Mean and Median from "Number of Rows"
Mustafa Mushtaq Oct 10, 2017 12:18 PM (in response to Hari Ankem)This is helpful.
Perhaps I should have been a bit more clear. What I'm looking for is a visual like this:
And this:
But instead of the count of the number of records (or the sum), I'm looking for mean and median. So, essentially, there will be 6 different dashboards:
1. Showing TOTAL Cases by Weekday (done)
2. Showing TOTAL Cases by Hour (done).
3. Showing MEAN Cases by Weekday.
4. Showing MEAN Cases by Hour.
5. Showing MEDIAN Cases by Weekday.
6. Showing MEDIAN Cases by Hour.
As can be seen, I need help with 36. You were on the right track, but I probably wasn't clear enough on what I wanted. Hope this helps you (with helping me!)

5. Re: Calculating Mean and Median from "Number of Rows"
Hari Ankem Oct 10, 2017 1:07 PM (in response to Mustafa Mushtaq) 
6. Re: Calculating Mean and Median from "Number of Rows"
Mustafa Mushtaq Oct 10, 2017 1:29 PM (in response to Hari Ankem)Yes, so that is in May 2015. The analysis only requires JulyOctober for 20142017.
The more recent data like Sunday 10/8/2017 and Sunday 10/1/2017 contains 34 and 27 cases, respectively, for just CESMH (I need both departments).
Would there be a way to do what I need graphically, like in the pictures I posted above?

7. Re: Calculating Mean and Median from "Number of Rows"
Hari Ankem Oct 10, 2017 1:54 PM (in response to Mustafa Mushtaq)OK. So, how do you want to compute the mean? Is it a mean of the department values? You must have thought something about it.

8. Re: Calculating Mean and Median from "Number of Rows"
Justin Larson Oct 10, 2017 4:37 PM (in response to Mustafa Mushtaq)What you are describing is taking the sum of records per day, then taking the mean/median of those aggregated values. Taking an aggregate of an aggregate warrants either a table calculation or an LOD calculation. The LOD calculation could look like:
{ INCLUDE DATEPART('weekday', [Ed Arrival Dttm]):SUM([Number of Records])}
and you would drop that into your view, setting aggregation to either avg or median.
What this does is preaggregates at weekday level, repecting any additional filters or dimensions you have on your view, and then averages/medians that set.
When you were taking the avd/median of [Number of Records] it was calculating at the rowlevel, and every row contains 1 in that field. So the Avg or median of a bunch of 1s is always 1.

9. Re: Calculating Mean and Median from "Number of Rows"
Mustafa Mushtaq Oct 11, 2017 7:59 AM (in response to Justin Larson)Hey Justin,
I entered that expression and it still gives me the same problem I'm currently having.

10. Re: Calculating Mean and Median from "Number of Rows"
Justin Larson Oct 11, 2017 8:35 AM (in response to Mustafa Mushtaq)sorry, sample calculation was for weekday, irrespective of date:
{ INCLUDE DATETRUNC('day', [Ed Arrival Dttm]) : SUM([Number of Records])}

Tab Community.twbx 468.4 KB


11. Re: Calculating Mean and Median from "Number of Rows"
Hari Ankem Oct 11, 2017 4:11 PM (in response to Mustafa Mushtaq)
Tab Community.twbx 549.3 KB
