Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quarters

Status
Not open for further replies.

muffntuf

MIS
Jan 7, 2003
155
US
Okay awhile back I asked for help with Quarters and here is what was suggested below. When I group on this the only group I get back is QT1 even though the Tran_date is forced between '08/01/2005' and '08/31/2005'. I don't understand why it is not showing up as 'QT3'. Does anyone see anything that should be changed?

If (DatePart("q", {Command.Tran_Date})) in [1,2,3] then "QT1"
else
If (DatePart("q", {Command.Tran_Date})) in [4,5,6] then "QT2"
else
If (DatePart("q", {Command.Tran_Date})) in [7,8,9] then "QT3"
else
If (DatePart("q", {Command.Tran_Date})) in [10,11,12] then "QT3
 
else
If (DatePart("q", {Command.Tran_Date})) in [7,8,9] then "QT3"
else
If (DatePart("q", {Command.Tran_Date})) in [10,11,12] then "QT3"

Shouldn't that be QT4?
 
Yes it is a typo, but still the effect is giving me only QT1, not QT3 as the date selection states.
 
If you look at the on-line help for datepart, I think you would discover that this will work:

If (DatePart("q", {Command.Tran_Date})) =1 then "QT1"
else
If (DatePart("q", {Command.Tran_Date})) = 2 then "QT2"
else
If (DatePart("q", {Command.Tran_Date})) =3 then "QT3"
else
If (DatePart("q", {Command.Tran_Date})) =4 then "QT4"

DataDog
'Failure Is Not An Option'
 
That is correct! Somehow I translated that to be the in 1,2, 3 which would have been month(s) 1, 2, or 3. Thanks for clearing that up!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top