I’ve just faced an interesting issue in Power BI when I tried to setup a new measure on a page which is a drill-through page by measure.
Scenario: I have a measure, call it Nr of Deliveries. This measure is based on a Order Table, which have Order Date and Delivery Date assigned to the order. The basic date is the Order Date in the report, but for the above mentioned measure I need to use the Delivery Date. So I’m using the formula:
CALCULATE(
DISTINCTCOUNT(Order[Order ID])
,USERELATIONSHIP(Order[Delivery Date],Calendar[Date])
)
I set up a page with few visuals showing the Nr of Deliveries by Date, by Sales Rep, by Region, etc. I also created a Details page, which is a drill-through page having the Nr of Deliveries measure in the drill-through by section.
The issue: I tried to set up a new measure in the Details page – for my current job I wanted to create a link measure to reach out ot the order in the source system – which new measure tend to use the selectedvalue function capturing the selected Order ID. Unfortunately when I simply used SELECTEDVALUE(Order[Order ID]), the value was blank.
I investigated it for a while and also tried to find some posts about it, but for a while I couldn’t. Finally it seems that the solution is that I have to use the same USERELATIONSHIP part for that new measure, without that it is not working.
So finally the following formula solved the issue and showing up well:
CALCULATE(
SELECTEDVALUE(Order[Order ID])
,USERELATIONSHIP(Order[Delivery Date],Calendar[Date])
)
Learned something new today again. Filter context in PBI is still existing.

Leave a comment