I will start with your first example that I tried to reproduce but with the scenario you provided it looks that Hours spent together with Sprint works exactly as you would expect it.
Here is an example where I used precisely the date you mentioned and when the hours were logged.
In the second example, it looks that the issue was already added to the Sprint when hours were logged, and only after that, the Sprint was started. In this case, hours are counted into the Sprint and you need to create a calculated measure in Measure dimension that you already mentioned above. Tested with my example and it works like a charm where the measure Hours spent within the Sprint takes into account only hours logged after Sprint start date.
Could you please share more information about what exactly didn’t work for you?
There is one similar thread about hours spent in another community question, maybe solution provided there could be useful for your case: