mrmmickle1
Well-known Member
- Joined
- May 11, 2012
- Messages
- 2,461
I was able to create this Dax Forumula with some help from a Marco Russo SQLBI blog post:
It looks to be off by a little bit....
When I sort my 467 Salary values in Ascending Order I have
Data like this:
Excel Median Function returns 42,500. DAX Formula Returns 43,000.
Shouldn't the answer be 42,500?
Code:
=( MINX (
FILTER (
VALUES ( Data[Salary] ),
CALCULATE (
COUNT ( Data[Salary] ),
CLT_Data[Salary]
<= EARLIER ( Data[Salary] )
)
> COUNT ( Data[Salary] ) / 2
),
Data[Salary]
)
+ MINX (
FILTER (
VALUES ( Data[Salary] ),
CALCULATE (
COUNT ( Data[Salary] ),
Data[Salary]
<= EARLIER ( Data[Salary] )
)
> ( COUNT ( Data[Salary] ) - 1 ) / 2
),
Data[Salary]
)
) / 2
It looks to be off by a little bit....
When I sort my 467 Salary values in Ascending Order I have
Data like this:
Excel 2010 | |||
---|---|---|---|
A | |||
233 | 42500 | ||
234 | 42500 | ||
235 | 43000 | ||
Sheet1 |
Excel Median Function returns 42,500. DAX Formula Returns 43,000.
Shouldn't the answer be 42,500?