Adni
Adni

Reputation: 133

Power BI - DAX measure. Slicer values from another table

Three tables. Many to one relationship between A - X, and B - X (cross filter direction both selected in Power BI)

As screenshot below displays, in PBI I'd like to have a measure called Return %. My date slicer works fine (TableX[Date]), it returns per day sales amount and untis sold/returns.

However, the second slicer (TableA[Product]) only returns accurately Sales. In this instance:

100+120 = 220

Which DAX measure would enable the second slicer to filter correctly through table B? I've tried with:

return% = calculate(sum(B[Returns]) / sum(B[Units sold]), SELECTEDVALUE(A,[Product])

Without any results..Please find below Screenshot for illustration.

Thanks

enter image description here

Upvotes: 0

Views: 2063

Answers (1)

Marco Vos
Marco Vos

Reputation: 2968

You are probably looking for something like this:

return% =
VAR selection_A_product = SELECTEDVALUE ( A[Product] )
RETURN
    CALCULATE (
        SUM ( B[Returns] ) / SUM ( B[Units sold] ),
        B[Product] = selection_A_product
    )

Upvotes: 3

Related Questions