See the attached. First of all, since the Days to Return (copy) is in the view, any SUM(Returns) is going to be partitioned by just the Days to Return because the view is at that level of detail. In that case, to generate a total of all returns, we turn to table calculations, for this worksheet the TOTAL() calc works - you can see that in the workout worksheet.
Secondly, the total number of sales crosses more than 30 days, and you were running into an issue with the order of operations in Tableau. In the "table - all" worksheet there are 626 purchases, but in the "graph - rate each day" worksheet you had filtered only for returns from 1-30 days, so there were fewer records to be computed over. The trick here is to use a table calculation filter, which is applied after most other calculations are computed (but before most reference lines are computed). I created a calc with the formula LOOKUP(ATTR([Days to Return]),0) and used that instead of the other filter, and now the reference line shows 22.2%.
ReturnExample jtd edit.twbx.zip 147.8 KB
Thank you, Jonathan! This is an elegant solution.
I think I need to brush up on (actually- learn) table calculations. Thank you again