Summarize Sum do not work when using ->state()

Why summarize is not working?

Tables\Columns\TextColumn::make('Price Sum + VAT')
  ->label('Price Sum + VAT')
  ->state(function (Booking $record): int {
      $dealsPriceSum = $record->deals->sum('price');
      $vat = $record->vat;
      $totalSum = $dealsPriceSum + ($dealsPriceSum * $vat / 100);
      return $totalSum;
  })
  ->wrapHeader()
  ->alignment(Alignment::End)
  ->money('gbp', divideBy: 100)
  ->searchable(isIndividual: true)
  ->sortable()
  ->toggleable(),


Adding

->summarize(Sum::make())


I get:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Sum + VAT) as "FwZmbsGj3ZnDrmtk" from (select `bookings`.*, (select count(*) fro' at line 1
SELECT
  sum(bookings.deals_count) AS "gJMaXg3YF2Y1Elu1",
  sum(bookings.Price Sum + VAT) AS "FwZmbsGj3ZnDrmtk"
FROM
  (
    SELECT
      `bookings`.*,
      (
        SELECT
          count(*)
        FROM
          `deals`
        WHERE
          `bookings`.`id` = `deals`.`booking_id`
      ) AS `deals_count`
    FROM
      `bookings`
  ) AS `bookings`


Thanks.
Was this page helpful?