Have you tried it like this:
source=X * | eval ratio=A/B | stats avg(ratio) by date_hour
Have you tried it like this:
source=X * | eval ratio=A/B | stats avg(ratio) by date_hour
I feel like I do this so often. Yes I did try that, but you reminded me I needed to capitalize the fields. I'm positive splunk is case-sensitive.