addQuarter function in the Factory
The addQuarter function adds a given number of quarters to a date attribute.
Parameters Parameter Description date The date attribute we want to add quarters to. The date parameter is mandatory. nquarter The number of quarters to add to the chosen date attribute. The nquarter parameter is mandatory. A quarter is made up of three months. Date type valid formats (if the values aren’t this format, the function will return an error). 2019/10/12; 12/10/2019; 2019-10-12; 12-10-2019; 2019/Oct/12; 12/Oct/2019; 2019-Oct-12; 12-Oct-2019. Example The following example uses the Bike Sales dataset. Description Screenshot In this example, we want to add two quarters to the Date attribute. We type the following formula in the addquarter attribute: and the attribute will be filled with the Date attribute’s values postponed by two quarters, that are six months. The results are: In row 1, the Date value 2013-11-26 becomes the addquarter 2014-05-26 value. In row 2, the Date value 2015-11-26 becomes the addquarter 2016-05-26 value. and so on.addQuarter(date, nquarter)
addQuarter($"Date",2)