LoriPelzel
Qrew Member
2 years ago

# YTD and PYTD VALUES

I have one table that had all my sales for two years.  I am trying to get the YTD AND PRIOR YTD totals based on a manufacture and based on the distributor.

manufacturer
distributor  date. Month. Prior Year Month

this goes on for YTD AND PYTD.  I'm also needing the \$ diff and 0/0 percentage diff.

had no luck with help desk but they are trying.  If you could help I would be forever grateful (and probably still employed).

------------------------------
Lori Pelzel
248.869.2000
------------------------------

### 4 Replies

• Can you tell us the fields in your table?

------------------------------
Mark Shnier (Your Quickbase Coach)
mark.shnier@gmail.com
------------------------------
• Mark,
I've attached a couple reports. For the Steiner 2022 and Steiner 2021 you will need to look at the NMTD and PMTD. On the 2022 report it shows a total of \$30804.00 for PMTD sales YET on the 2021 report it shows \$37,866.00 for the NMTD (which is the other reports PMTD. It doesn't make and sense to me. The information is coming from the same table, same fields. I think for this issue its that the report only shows sales from the current distributors for this year and drops any from the report that were sales last year for the same month. I need the report to show this years monthly sales and ANY sales from last year same period.

I just don't see how this can be so complicated.
The fields are :

Manufacturer
Distributor
Date (WTF field)
NMTD (monthly sales)

PMTD - not working right
var date datevariable = AdjustYear([WTF], -1);

//\$datevariable

SumValues(GetRecords("{9.EX.'"& [Distributor] &"'} AND {12.EX.'"& [Manufacturer] &"'} AND {11.OBF.'"& \$datevariable &"'} AND \n{11.OAF.'"& FirstDayOfMonth(\$datevariable) &"'}"), 159)

YTD - not working right

var date datevariable = FirstDayOfYear([WTF]);

//\$datevariable

SumValues(GetRecords("{9.EX.'"& [Distributor] &"'} AND {12.EX.'"& [Manufacturer] &"'} AND {11.OAF.'"& \$datevariable &"'} AND \n {11.OBF.'"& [WTF] &"'}"), 159)

PYTD - not working right
var date datevariable = AdjustYear([WTF], -1);

//\$datevariable

SumValues(GetRecords("{9.EX.'"& [Distributor] &"'} AND {12.EX.'"& [Manufacturer] &"'} AND {11.OBF.'"& \$datevariable &"'} AND {11.OAF. '"& FirstDayOfYear (\$datevariable) &"'}"), 159)

Any thoughts would be appreciated.
Lori

• Sorry, too complicated for me to tackle as a Forum Question

------------------------------
Mark Shnier (Your Quickbase Coach)
mark.shnier@gmail.com
------------------------------