# How to do month to date(MTD) calculation in a module

How to do month to date(MTD) calculation in a module
Tagged:

Its not MTD. It would be YTD

Refer the below screenshot for your reference

~Anand

• MONTHTODATE returns a cumulative sums across a month time span for a single numeric parameter then resets it value . The syntax is MONTHTODATE(x) .Below shows the application of MONTHTODATE function

When you observe clearly you can see that sum of Sales for week 1 and week 2 is equal to Monthvalue of week 2 , similarly sum of week 1, week 2, week 3 and week 4 is equal to Monthvalue in Week 4.

Now observe the value resets in Week 5 and starts calculating again for that particular month.

Also make sure that the time should be either in days or weeks, and the formula cannot be used, if model timescale is General Weeks.

(Correction: the line item says Monthvalue , but it's MONTHTODATE)

I hope it helps

~Anand

• @anand.shekhawat thank you for the detailed answer.

So for below example Monthvalue(Sales) should be 1600 correct ?

Rahul

• No, the MONTHVALUE(Sales) would return 260 for week 1-4 , 420 for week 5-8 and so on. It actually gives the month summary value as the output. Refer the below screenshot

I hope it helps

~Anand

• Ok.

@anand.shekhawat  So let me put my question in the other way.

Let say the time scale is month(Jan'21,Feb'21...) and sales(100,200...likewise) so my expected output for MTD should be 300. So how to get that output.

Rahul