简体   繁体   中英

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

在此处输入图片说明

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
    )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM