Since you don't have a Price column, you cannot create a matrix visual with the price on the rows, since measures cannot be used for the columns. But you can implement a calculated table like this
Result =
VAR Tab =
ADDCOLUMNS ( Prices, "Price", Prices[Value] / Prices[Unit] )
VAR Res =
ADDCOLUMNS (
Tab,
"Avg",
VAR CurPrice = [Price]
RETURN
AVERAGEX ( FILTER ( Tab, [Price] = CurPrice ), Prices[Value] )
)
RETURN
DISTINCT ( SELECTCOLUMNS ( Res, "Price", [Price], "Avg", [Avg] ) )
First we declare a table variable from the source table (I called it "Prices") adding the Price column, then we iterate over this table variable adding the "Avg" column using AVERAGEX
on the same table variable filtered by "Price". Finally we return the DISTINCT
of the two columns Price and Avg.
Edit:
It's possible to reduce the number of rows adding a variable to get the distinct prices
Result1 =
VAR Tab =
ADDCOLUMNS ( Prices, "Price", Prices[Value] / Prices[Unit] )
VAR DistinctPrices = DISTINCT( SELECTCOLUMNS( Tab, "Price", [Price] ) )
VAR Res =
ADDCOLUMNS (
DistinctPrices,
"Avg",
VAR CurPrice = [Price]
RETURN
AVERAGEX ( FILTER ( Tab, [Price] = CurPrice ), Prices[Value] )
)
RETURN
DISTINCT ( SELECTCOLUMNS ( Res, "Price", [Price], "Avg", [Avg] ) )