Increase month

Hassan Waseem 1 Reputation point
2021-11-11T11:36:16.697+00:00

How can we increase the number of months incrementally just like we do in addDay function in Data Factory

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,579 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Saurabh Sharma 23,806 Reputation points Microsoft Employee
    2021-11-11T20:45:20.8+00:00

    Hi @Hassan Waseem ,

    Thanks for using Microsoft Q&A !!

    Unfortunately, AddMonths function similar like AddDay is currently not available in Azure Data Factory. You can have AddMonths functions available in DataFlow in Azure Data Factory. You can upvote an existing feedback over here so that other community members can also upvote and products team can plan to include this in future releases.

    Also, please refer to this thread which talks about extracting the current month using substring and doing calculations on the month part. You could use a similar approach based on your date value in your case.

    Thanks
    Saurabh

    ----------

    Please let me know if you find above reply useful. If yes, do click on 'Mark as answer' link in above reply. This will help other community members facing similar query to refer to this solution. Thanks.


  2. Krishna Tapse 0 Reputation points
    2024-03-11T11:34:34.59+00:00

    Hi Team,

    Use below Date Function in azure Data Factory, you can modify from below example and use as per your requirement

    Date Function: subtractFromTime

    Use: Subtract a number of time units from a timestamp. See also getPastTime.

    example : I want endOfMonth for my scenario then I am using below case

    @adddays(startOfMonth(subtractFromTime(formatDateTime('2024-02-15'), -1, 'Month)), -1)

    Answer: 2024-02-29

    Please do not forget to "Accept the answer" wherever the information provided helps you to help others in the community.

    Thanks,

    Krishna Tapse, India

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.