© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
3 replies
cpbret

Distinct Table Count

Adding distinct() makes it to the count query, but the column does not. Is there a different way?

TextColumn::make('responses_count')->counts([
'responses' => fn ($query) => $query->distinct('request_id')
])
->label('Responses')

SELECT DISTINCT count(*) FROM
responses
responses
WHERE
churches
churches
.
id
id
=
responses
responses
.
church_id
church_id
and
responses
responses
.
TYPE
TYPE
= 1) AS
responses_count
responses_count
FROM
churches
churches
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

table count status
FilamentFFilament / ❓┊help
3y ago
Custom table relationship count
FilamentFFilament / ❓┊help
3y ago
Widget Table : display records count
FilamentFFilament / ❓┊help
7mo ago
Records count in table header
FilamentFFilament / ❓┊help
2y ago