[Solved] Statistics of autofiltered records in subform

Creating and using forms
Post Reply
gkick
Posts: 324
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile

[Solved] Statistics of autofiltered records in subform

Post by gkick »

Hi,

I want to use a subform for drill down reporting, that is select the year,
then the month using the forms nav bar which works fine.
Below the form I want to display textboxes which may show the total of selected (filtered) records, average, highest ,....

Not sure if that actually can be done with using the nav bar for autofiltering as this does not provide a hook
for the where clause in the query for the textboxes

Do I need a filter table and listboxes for this or is there another option ?

Thanks for any ideas.
Attachments
stats.PNG
Last edited by Hagar Delest on Thu Sep 17, 2020 12:58 pm, edited 1 time in total.
Reason: tagged solved.
Libre Office 6.4.6 on Windows 10 HSQL 2.51 backend
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Statistics of autofiltered records in subform

Post by Villeroy »

This is easily doable with a filter table and some SQL.

Code: Select all

SELECT SUM("blah") AS "Sum", COUNT("blah") AS "Count", AVERAGE("blah") AS "Average" 
FROM "Table", "Filter" 
WHERE "Filter"."ID"=1 
  AND (same criteria as the subform filtered by the same filter row)
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
gkick
Posts: 324
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile

Re: Statistics of autofiltered records in subform

Post by gkick »

Thanks Villeroy
Libre Office 6.4.6 on Windows 10 HSQL 2.51 backend
Post Reply