Is it possible to use the RELATED() DAX function with a Measure in Power BI?
As per the official Microsoft documentation, the RELATED function needs a row context; therefore, it can only be used in calculated column expression, where the current row context is unambiguous, or as a nested function in an expression that uses a table scanning function. A table scanning function, such as SUMX, gets the value of the current row value and then scans another table for instances of that value.
So in your Measure, if you are using the CALCULATE
function that removes the row context, you will not be able to use the RELATED
function because the row context is no longer available, and in this case, you have to use the Filter
expression to define the row context and to be able to use the RELATED
function as below:
Measure = calculate( sum('Product List'[Sold]),FILTER('Product List', RELATED('Product Price (RELATED)'[ProductKey]) = 1 ))
Alternatively, you can create a calculated column that holds the related value,
Calculated Column(RELATED) = RELATED('Product Price (RELATED)'[Price])
Then use this column in your Measure as below:
Measure = sum('Product List'[Calculated Column(RELATED)])
Read more at Power BI: RELATED Vs LOOKUPVALUE DAX