Power BI DAX: How to calculate measure based the current value of dimension

248 Views Asked by At

I working with a Power BI report that has some measures in a fact table. We have Sales[YTD Amount] and Sales[QTR amount] in the fact table. We have another dimension named Product which has an attribute named LineItem. I want to calculate another measure like below

Updated_Qtr_Amount = If(Product[LineItem] = "Opening Balance", Sales[YTD Amount], Sales[Qtr Amount])

However, it throws an error that cannot find Product[LineItem] even though it exists in the dimension. If I use selectedvalue(Product[LineItem]), then it does not throw any error.

Can you please tell me how to access the current row value of the LineItem so that i can calculate the above measure?

1

There are 1 best solutions below

0
On

I have tried a few ways and using selectedvalue(Product[LineItem]) will actually work. It seems like you cannot use a field name directly from the dimension table