Skip to Content

Without writing CMOD coding get the difference of Month ,Day and Year.

Scenario : We are many scenario where we need to calculate no of days/month/years from given date range or month/year range.

Our fast approach is to write a CMOD and calculate the difference…. But best approach is to avoid code help…

A Difference of month based on the user input interval on the variable selection screen.

Say for Eg: if user input is 01.2012 to 03.2013 so the difference would be 15 Months.

So now i will going to sharing the same approach with step by step method:

Step 1 : Create a new formula —> Under that you have folder named as formula variable :–>Right click on it :

–>New variable:Given the details as wrote below.

created on DIFF Month , choose time characteristic based on your requirement.

Give description and technical name .

Type of Variable : Formula

processiing by Replacement path.

Reference characteristic : 0calmonth.


Step 2 :  click replacement path tab and give the details .

Replacement variable with : Variable.

Variable : 0I_CALMO (for month difference ) and 0I_DAYIN (for day difference) and 0I_CALYEAR (for year difference).

and reference characteristic : DATE characteristics.

processiing by Replacement path.

In theUse interval section choose Difference radio buttn.


Step 3:

In the currency/Unit tab choose dimension as Number.

Step 4:-Save this formula variable and Drag and drop into formula.Refer the screenshot.


Save the query and now let’s execute the query and check the results.


So as you can see that based on the input in variable selection screen we got the difference of Months.

Hope this might be useful.

You must be Logged on to comment or reply to a post.