cancel
Showing results for
Did you mean:
Frequent Visitor

## Dynamic Median of several measures

Hello all,

I'm having trouble making the following logic work using DAX.

I have several DAX measures that rank products from greater to lower based on sales, quantity and other variables. So for example, I have product A that ranks as number 1 in sales, as number 3 in quantity and 5 in other variable.

What I need is to calculate the median of all these measures so that I can get the "final rank". So continuing the above example, the median of product A should be 3.

I'm trying to create a measure that creates a table, then adds the measures as columns and then unpivot this calculated table so I can use the Median function. Making this is far more advanced from my DAX knowledge, so I haven't been able to create a solid draft of this code... Any suggesting?

André

2 REPLIES 2
Community Support

## Re: Dynamic Median of several measures

You may try the measure below.

```Measure 4 =
MEDIANX ( { [Measure], [Measure 2], [Measure 3] }, [Value] )
```
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Frequent Visitor

## Re: Dynamic Median of several measures

This won't work because it only takes into consideration one value (the second argument of the fuction). What I need is a measure that calculates, for each product at a time, the median of several measures. So if product A rank in sales is 4 and ranks 6 in quantity, the median of product A will be 5.

This is why I thought that createing a table and then unpivot it may be a solution but I don't have the skills to perform this yet.

André

Announcements

#### ‘Better Together’ T-Shirt Contest – Winner Announced!

And the winner is...

#### Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

#### April 2020 Community Highlights

Info on our Super Users, MBAS content and badges, and updates to our support articles. - Read the full Community Highlights.

#### MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

Top Solution Authors
Top Kudoed Authors