Flux still has 2 tables after union and group function

I am using flux to sum 5 minute data per day for the past 7 days. I use aggregateWindow on 2 columns and then union to join them back together. I use sort and fill to get the data on each time stamp together. This bit works fine. The issue I have is that the original table is still there.


data = from(bucket: "home")
  |> range(start: -7d)
  |> filter(fn: (r) => r["_field"] == "BATTERY_CHARGE"  or r["_field"] == "BATTERY_DISCHARGE")
  |> pivot(rowKey: ["_time"], columnKey: ["_field"], valueColumn: "_value")
  |> map(fn: (r) => ({r with "Battery_Discharge": r.BATTERY_DISCHARGE / 12.0}))
  |> map(fn: (r) => ({r with "Battery_Charge": r.BATTERY_CHARGE / 12.0}))
  |> keep(columns: ["_time", "Battery_Charge", "Battery_Discharge"])
Discharge_Sum = data
  |> aggregateWindow(column: "Battery_Discharge", every: 1d, offset: -8h, fn: sum)
Charge_Sum = data
  |> aggregateWindow(column: "Battery_Charge", every: 1d, offset: -8h, fn: sum)
union(tables: [Discharge_Sum, Charge_Sum])
  |> yield(name: "result")
  |> group(columns: ["_time"], mode: "by")
  |> sort(columns: ["Battery_Charge"])
  |> fill(column: "Battery_Discharge", usePrevious: true)
  |> tail(n: 1)
  |> group()
  |> tail(n: 7)
  |> drop(fn: (column) => column =~ /^(_start|_stop|_measurement|location|region)/)
  |> rename(columns: {Battery_Discharge: "Battery Discharge", Battery_Charge: "Battery Charge"})

The table data is as follows.

enter image description here

The bottom table is what I want to keep.

I have been unable to find anything that allows a table to be deleted. I have tried to filter out the first table value but after the union the filter functions only work on the output table.

any ideas?