Forum Discussion

TerriBruce's avatar
TerriBruce
Qrew Cadet
4 years ago

Date Formula for Reporting

I am trying to generate 2 monthly reports: One comes out on the first of the month and one comes out on the 16th of the month. I have a Start Date field. I'm trying to figure out how to filter the reports so the jobs with Start Dates fall on these reports:

First of the month: Start Date on or after the 21st of 2 months previous and Start Date on or before the 5th of the previous month (i.e for the February 1 report, Start Date would be December 21 - January 5

16th of the month: Start Date on or after the 6th of the previous month and Start Date on or before the 20th of the previous month (i.e. for the February 20 report, Start Date would be January 6 - January 20)

------------------------------
Terri
------------------------------

6 Replies

  • DonLarson's avatar
    DonLarson
    Qrew Commander
    Terri,

    If these two reports are the only place that you care about the Numerical Day in the field [Start], then a simple solution is to use Report Formulas.

    Here is a screen shot of it being set up.   This assumes that [Start] is Date field and NOT a Date/Time field.   If this assumption is false then inside the formula you first have to convert [Start]  to a Date and then use Day() on the result.



    ------------------------------
    Don Larson
    Paasporter
    Westlake OH
    ------------------------------
    • TerriBruce's avatar
      TerriBruce
      Qrew Cadet
      Thank you, Don. I've never worked with Report formulas before so I've learned something new. I can't figure out how to make it work for the report I need on the 1st of the month because it has to be >20 two months ago but <5 last month.  Any suggestions?

      ------------------------------
      Terri
      ------------------------------
      • DonLarson's avatar
        DonLarson
        Qrew Commander
        Terri,

        I read your date ranges incorrectly the first time.  I am going to assume that you will have two separate reports on the 1st or 16th, export the data and then not use those reports again.

        Build custom dates based upon Today() that will be the correct dates for your report on that day using the ToDate() function.  ToDate("1/30/00") will give you January 30th of 2000 as a date field that you can report on.   You just need to build the month, day and year pieces formulaically. 

        1. Take Today() and move it to the calendar month you want using AdjustMonth().
        2. Then strip out the value of the Month() or value of the Year()
        3. Change them to Text values using ToText() which is what ToDate() requires as the argument of the function
        4. String them together to build the date that you want using quotes, "",  and ampersands , &, to get the text string you need.

        Here is an example



        That should give you the 21st day of the month from two months back.  Edit and repeat this for your Report Stop Date.

        ------------------------------
        Don Larson
        Paasporter
        Westlake OH
        ------------------------------