angbrav Posted March 7, 2012 Posted March 7, 2012 Hi everyone! Firstly, I'd like to clarify that I'm not sure if this post fits in this section. If not, feel free to reallocated! Secondly, I'm going to present my problem: - My DB. I have a table of Clients. This table is linked to a Bills table in a 1...n relationship using the clientID. I am storing when the bill was generated. - I'm trying to generate a report which shows a top 10 of clients for a given year. The clients should be sorted for the amount of money they spent. That amount would be generated as the sum of client's bills for the year chosen. My main problem is how to sum the bills of a client for a given year. Thank you in advance, Manuel
angbrav Posted March 7, 2012 Author Posted March 7, 2012 After 56 views and no reply, I guess what I'm trying to do is not possible... Could does anyone tell me if I should discard this idea?
JerrySalem Posted March 7, 2012 Posted March 7, 2012 You need a relationship from clients to bills that includes the given year and client id. then a calc field in clients that sums the related bill totals.
comment Posted March 7, 2012 Posted March 7, 2012 Another option is to find the bills for a given year and sort them by client, reordered by a summary field. Finally - and this is the more difficult part - omit the records in group #11 and beyond. See something similar here: http://fmforums.com/forum/topic/69793-limiting-find-to-first-5-records/
angbrav Posted March 8, 2012 Author Posted March 8, 2012 You need a relationship from clients to bills that includes the given year and client id. then a calc field in clients that sums the related bill totals. Sorry, I don't know how to create that relationship.. I already have a relationship between them using the ClientID but I don't know how to add the year os the bill in that relationship. Would you mind being more specific?
angbrav Posted March 8, 2012 Author Posted March 8, 2012 Another option is to find the bills for a given year and sort them by client, reordered by a summary field. Finally - and this is the more difficult part - omit the records in group #11 and beyond. See something similar here: http://fmforums.com/forum/topic/69793-limiting-find-to-first-5-records/ I tried your solution and it works! thank very much!
Recommended Posts
This topic is 4899 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now