Your requirement is an interesting challenge!
Please check out the attachment for my solution.
The shortage is that, it's difficult to use a line graph to display the result. So I used a bar graph.
It seems that there is bug for function datepart() and datetrunc(),
so I created additional calculated fields [Corrected Hour] and [Corrected Day] to correct the calculation.
ts-test.twbx 155.5 KB
Thank you Lei, really elegant solution. It's a pity I can't use the line graph.