Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

CALC MONTH TO DATE FROM YEAR TO DATE

I am trying to calculate Month To Date data (MTD), I already have Year To Date (YTD) Data coming from the source.  Can you please help

Here is the sample data

YRMTH        YRMTH                          Sales (YTD)
2015072015Jul20
2015072015Jul30
2015062015Jun40
2015052015May55
2015062015Jun65
2015012015Jan75
2015012015Jan80
2015042015Apr90
2015072015Jul95
Sales Data is Cumulative 
4 Replies
satishkurra
Specialist II
Specialist II

Please find below the script for MTD and previous year MTD

MTD

=Sum({$<Date={">=$(=Num(MonthStart(Max(Date))))<=$(=Max(Date))"}>}Sales)

MTD-1

=Sum({$<Date={">=$(=Num(MonthStart(Max(Date),-12)))<=$(=AddYears(Max(Date),-1))"}>}Sales)

Date is the transaction date

Not applicable
Author

Whast the format for your "Date" field, mine is 'YYYYMM'

satishkurra
Specialist II
Specialist II

Ok in that case first in scripting window, set your date format to YYYYMM and then no need to change in the above expression.

Or if youthink the expression only requires the change perform below

MTD

=Sum({$<Date={">=$(=Num(MonthStart(Max($(=Date(Date,'YYYYMM'))))))}>}Sales)

MK_QSL
MVP
MVP

=SUM({<YRMTH = {"$(=Date(Today(),'YYYYMM'))"}>}Sales)