If you're riding a Simulation such as Zwift or Rouvy, the app will calculate the virtual distance you've traveled using data such as your power, your weight, and the virtual terrain. Your virtual mileage should be similar to what you'd achieve outdoors.
Potential sources of error:
- The simulation app has made an assumption that doesn't reflect your outdoor rides. More on this topic from Zwift Insider.
- Your power isn't being reported accurately. Troubleshoot power readings here.
If you're using an ERG app, such as TrainerRoad, there's no virtual terrain, thus no distance. Power is the important measure of an ERG mode workout.
Why can't I calculate my distance using my wheel speed and length of my ride?
The only speed that is reported by Fliiiight is the speed of your wheel. This is an important part of your power calculation, but is otherwise irrelevant: In ERG mode, you can spin your wheel at 70km/h or 15km/h and it won't change the difficulty of the workout. Whatever your gear or wheel speed, the trainer will adjust the resistance make sure you hit your target Power level in watts.
More on this topic from TrainerRoad