There are 3 outcomes at every trial, 4,7 and something else. I will denote "something else" by 0. It has a probability of 17/24.
The only way that a 4 can appear before a 7 is if you roll it on the first go; or you roll 0 a few times and then get a 4. So you are interested in the followign events
which have probabilities
You can recognise the above as a geometric progression, with first term ; and common ratio . use the standard formula for the sum of an infinite geometric progression
The fact that the answer is 3/7 may not be surprising. Can you see why?