Forum Discussion

JenniferJuhasz's avatar
Qrew Trainee
3 years ago

Formula Query - How to return values within a Quarter or summarize data within a Quarter?


Is there a way to build a query that follows this function, but for quarters, not year?

var text QUERY = "{7.OAF.'" & FirstDayOfYear([Month]) & "'} AND {7.OBF.'" & LastDayOfMonth([Month]) & "'}";


Essentially, I want exactly what this current query does, but with the quarter specified.  I do have a 'Quarter' field that's calculated like this:

But I'm not sure how to utilize it in my query to specify the date range.
I think I need this formula function:
LastDayOfPeriod([Payment Date], [Quarter Length in Days], [Fiscal Year Start Date]) returns the last day of the quarter in which the Payment Date falls.

But I keep getting Syntax errors when I try to input Quarter Length in Days.  I tried to specify the # of weeks instead, but again, I couldn't quite get past the Duration p, Date r without generating errors.

Can you help point me in the right direction with these?

Thank you!​

Jennifer Juhasz

2 Replies

  • The LastDayofPeriod functions would not be used for calendar Months.  those are typically used for 2 week payroll cycles for example.

    Since you already have a field say fid 99 for the Quarter, you can just add in an extra AND to your query

    AND {99.EX.'" & [Quarter] ....  

    Mark Shnier (YQC)
    • JenniferJuhasz's avatar
      Qrew Trainee
      Hi Mark,

      This worked perfectly! Thank you!!  Eventually I'll get the hang of these formula queries...  I appreciate your help.


      Jennifer Juhasz