Skip to Content
Author's profile photo Sandeep a

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.

1.JPG

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.

2.JPG

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.

4.JPG

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

5.JPG

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.

Regards
Sandeep

Assigned Tags

      10 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Sandeep,

      Thank you for sharing , it will be helpful for us without using code.

      Regards,
      Giri

      Author's profile photo Sandeep a
      Sandeep a
      Blog Post Author

      thanks lot giri peram

      Regards

      Sandeep

      Author's profile photo Former Member
      Former Member

      Thanks Sandeep,

        

      Step 3:

      In the currency/Unit tab choose dimension as Number. 

      Screen is repeated,

      Please clarify.

      Author's profile photo Sandeep a
      Sandeep a
      Blog Post Author

      Hi Amir,

      Thanks Amir for ur Suggestion.

      Regards .

      Sandeep

      Author's profile photo karthick Ravichandran
      karthick Ravichandran

      Good Work Sandeep.Helpful one

      Author's profile photo Sandeep a
      Sandeep a
      Blog Post Author

      Thanks karthick for your cheerful comments.

      Regards,

      sandeep

      Author's profile photo Harshawardhan Ghatge
      Harshawardhan Ghatge

      Great document. can you tell me a real time scenario where we need to calculate difference in date/month from user input.

      Author's profile photo Anshu Lilhori
      Anshu Lilhori
      Author's profile photo Matthew Billingham
      Matthew Billingham

      I also note that Step 3 onwards had been copied word for word (except for the step numbers) from your blog.

      Author's profile photo Sandeep a
      Sandeep a
      Blog Post Author

      hi harshawardhan,

      You need to calculate some personnel metrics like equivalent labor class  The formula is to take the the total number of absences and divide by the number of available work days (the client doesn't have the system calendar set to give work days, and they change the number of work days at report execution time

      Regards

      sandeep