Table Column Summary using Quantity
I have the following table column and 'Sum' working in the attached screenshot.
My code for this is as follows:
My problem is that the sum doesn't take into each row's quantity.
How can I make the sum take each row's quantity into account?
For example, I need to mulitply each row's price * it's quantity then sum all of those.
Thanks for any insight into this!
4 Replies
This?
Getting quite close. Had forgotten that my quantity column is a 'string'. Might be able to switch that to integer.
One of those fun projects where lots of external system integrations so the data you get, isn't always ideal.
Tried adding some casts in there but it doesn't seem to like those much
Hmm doesn't appear to be due to my quantity column as I still get the error with
->using(fn (\Illuminate\Database\Query\Builder $query) => $query->sum(DB::raw("price")))
SQLSTATE[42601]: Syntax error: 7 ERROR: zero-length delimited identifier
Hmm so I think I see the problem at the end of the query
current code:
I think I have identified a bug in Filament from this on Postgres
'bug'Are you sure posstgres isn’t the ‘bug’ lol. Just kidding. 😜