A couple of things;
First if you do a countd on Returned, you will get 1 because Returned have only the value 'Yes'. What you need is to compute the Returned Order ID with if [Returned] = 'Yes' then [Order ID] end.
Now since your relationship is with the Order ID, and you don't have a date in the secondary source, you cannot compute the countd in the secondary source, you have to do it in the primary.
As you can see on the sheet ValidateData, you can then compute the distinct count in the primary source using the Window_Count.
It counts a single Order ID value event if the source have many number of records for the Order ID.
WINDOW_COUNT( ATTR([Returns (Sample - Superstore)].[Order ID returned]) )
Now, for this you need to have the Order ID on the Detail (in order for the ATTR function to work).
And to keep a single value , you need to add a filter.
Check on Final View
do you have you a solution in any of the work book?
Did you check in the attached ?
Sheet FinalView and ValidateData
thank you Michel. I couldn't find it for some reason.