Hello,

Currently I want to sum sales based for MTD, QTD, and YTD. I don't use dates, but instead use a combination of the year and the month (i.e. 201601 or 201612). I use sumifs to grab items between two dates. MTD is easy:

=SUMIFS(TableA[SALES],TableB[CATEGORY],$A23,TableB[fiscalMoAsNo],A22) where A22 is some calculated date like 201612

YTD not too bad:

=SUMIFS(TableA[SALES],TableB[CATEGORY],$A23,TableB[fiscalMoAsNo],">="&A21,TableB[fiscalMoAsNo],"<="&A22)

A21 always is the 1st month of the year like 201601 and A22 is the current month like 201612 so it gets automatically selected.

Stuck on how to do this for QTD. Essentially I am thinking to use the formula for YTD but I need both of the fiscalMoAsNo to change - One to determine the first month of the Quarter and the second to use the current month. Current month just is the A22 value, but how to choose the A21 or first month of the Qtr?

Can someone suggest some possible formulas or perhaps a psuedocode that would follow this logic? Thanks!

Vas