G
Guest
Hi there.
I am working on a query of a query...the underlying sub-query has the
following characteristics:
tblProfitability - [DealID], [StartDate], [EndDate] and [DailyProfit]
In tblProfitability there can easily be 15+ date ranges (i.e. start date -->
end date), each of which cooresponds to a different daily profit (as deals
can be changed during their life). The query I am working on is attempting to
rollup (group) tblProfitability by DealID. As part of this rollup, I want to
return the latest [EndDate] (so I use "Max" - which works), as well as the
[DailyProfit] that cooresponds to that specific [EndDate] or, more generally,
the record of which [EndDate] is a part.
I tried to use "Last", as I sorted the tblProfitability by [DealID] and then
by [EndDate], but this seems to return arbitrary profit figures (most of the
time they do not coorespond to the LATEST profit figure).
Can anyone provide some advice/assistance as to how I might be able to do
this? Feel free to ask any questions if my problem requires clarification.
Thanks in advance,
David
I am working on a query of a query...the underlying sub-query has the
following characteristics:
tblProfitability - [DealID], [StartDate], [EndDate] and [DailyProfit]
In tblProfitability there can easily be 15+ date ranges (i.e. start date -->
end date), each of which cooresponds to a different daily profit (as deals
can be changed during their life). The query I am working on is attempting to
rollup (group) tblProfitability by DealID. As part of this rollup, I want to
return the latest [EndDate] (so I use "Max" - which works), as well as the
[DailyProfit] that cooresponds to that specific [EndDate] or, more generally,
the record of which [EndDate] is a part.
I tried to use "Last", as I sorted the tblProfitability by [DealID] and then
by [EndDate], but this seems to return arbitrary profit figures (most of the
time they do not coorespond to the LATEST profit figure).
Can anyone provide some advice/assistance as to how I might be able to do
this? Feel free to ask any questions if my problem requires clarification.
Thanks in advance,
David