I have a BAQ designed to show a certain bin locations and any quantities located in those bins. I would like to see the last time a specific part was transacted in that bin. To do this a subquery was setup for the PartTran table. The only fields selected for the PartTran table are: PartNum, BinNum, and a calculated field named MaxTranDate. The PartNum & PartBin from the subquery are used to link to the PartBin table like-named fields. I would like to get MaxTranDate from the subquery to show the last transaction date for that Part Number + Bin.
In Crystal, I would have had the subreport read all of the details (suppressed), and added a group footer to show the max(trandate).
From the BAQ Designer, how do I say max(trandate)? Note, the max function only appears to work on integers.
Do I need to use grouping to somehow to use eliminate duplicated records? If so, how?
Just to add on to what Calvin says, when you use grouping you have 2 rules:
Any field that is aggregated (sum, count, avg, etc) must be set to NOT GroupBy
All other fields MUST be set to GroupBy
If you need other info not needed in this grouping, as Calvin mentions, you can make a subquery and link the results back.
Were you able to get this working? I’m having the same issue. I linked the SubQuery but it’s returning all of the transaction’s not just the last one.
Yes I did get it working, maybe your subquery isn’t linked correctly, I do know there are multiple ways to do this. @ckrusen is far more fluent than me. I use BAQ sometimes, but not constantly.
Sorry for the Necropost, but this one has me stumped.
How do I get only the cost associated the max tran date? more details…
This time I want the the cost associated with the last transaction date pulled from the subquery from above. As soon as I bring in the cost field it adds the grouping by each different cost. I did a max cost along with the max trandate which brings in a single record for the part, but the max cost is associated with a previous date.