I got this type of table:
quantity | price | |
---|---|---|
0 | 1 | 12 |
1 | 2 | 10 |
2 | 3 | 5 |
3 | 1 | 7 |
I need to find median price. But first I need make array with prices:
[12, 10, 10, 5, 5, 5, 7]
So I need make duplicates of price values. And count median for this array.
How to make it in Power BI with DAX statement?
Your sample table is called Test.
Measure =
MEDIANX(
GENERATE(
Test,
VAR x = GENERATESERIES(1,Test[quantity], 1)
RETURN x
),
[price]
)