+++ title = " Creating a Calculated Field" chapter = true weight = 503 +++
  1. Navigate back to the Data Tab for your NYC_Taxi dataset and look at the different fields in the dataset.
  2. The field titled “trip_distance” is a float field that shows the distance of each trip in miles. What if someone who wanted to use this dataset wanted to know the trip distance in kilometers? With Dremio, you can create a calculated field. Click the downward arrow next to the “trip_distance” field and then click on “Calculated Field”
  3. From the “Add Calculated Field” page you can use SQL functions to create or replace fields in the Dremio Virtual Dataset. To convert Miles to KM, you will multiply “trip_distance” by 1.6.
  4. Dremio provides the ability to either replace the existing field with the new calculated field or to create a new field. Since we want to keep both miles and kilometers, we are going to uncheck the “Drop Source Field” box and name the field “trip_distance_km” . Once this is done, press Apply .
  5. Once you select Apply, Dremio returns to the Data Tab. Now you can see that there is a new field called “trip_distance_km” as well as the SQL command that Dremio has written.
  6. Since we have made a modification to the Virtual Dataset, we are going to save this as a new VDS to our Space. Click the arrow to expand the “Save View” menu and click “Save View As”. Name your dataset “NYC_Taxi_KM”, choose your Space, and click “Save”.
  7. Navigate back to the Dremio Home Screen and you will notice two Virtual Datasets in your Home Space: NYC_Taxi & NYC_Taxi_KM. You will also notice that the tags you created for the NYC_Taxi dataset are visible. This makes it easy to identify datasets.