Forum Discussion
Calculating date and count columns?
- Anonymous3 years ago
Hi Anonymous ,
It seems that there is null value in the field 'rm_loc_component_cycles'[next_date], and in order to avoid February having different days in different years get error, for example next_date is 2024/2/29, cycle length is 3. Then the next renewal will be date(2027,2,29) base on your formula. It will also be wrong....
So please update the formula of calculated column [Next renewal] as below and check if it can return the expected result... Please find the details in the attachment.
Next renewal = VAR _year = YEAR ( 'rm_loc_component_cycles'[next_date] ) + 'rm_loc_component_cycles'[cycle_length] VAR _month = MONTH ( 'rm_loc_component_cycles'[next_date] ) VAR _day = DAY ( 'rm_loc_component_cycles'[next_date] ) VAR _eomonth = EOMONTH ( DATE ( _year, _month, 1 ), 0 ) RETURN IF ( ISBLANK ( 'rm_loc_component_cycles'[next_date] ), BLANK (), IF ( _day > DAY ( _eomonth ), _eomonth, DATE ( _year, _month, _day ) ) )Best Regards
Hi Anonymous ,
It seems that there is null value in the field 'rm_loc_component_cycles'[next_date], and in order to avoid February having different days in different years get error, for example next_date is 2024/2/29, cycle length is 3. Then the next renewal will be date(2027,2,29) base on your formula. It will also be wrong....
So please update the formula of calculated column [Next renewal] as below and check if it can return the expected result... Please find the details in the attachment.
Next renewal =
VAR _year =
YEAR ( 'rm_loc_component_cycles'[next_date] ) + 'rm_loc_component_cycles'[cycle_length]
VAR _month =
MONTH ( 'rm_loc_component_cycles'[next_date] )
VAR _day =
DAY ( 'rm_loc_component_cycles'[next_date] )
VAR _eomonth =
EOMONTH ( DATE ( _year, _month, 1 ), 0 )
RETURN
IF (
ISBLANK ( 'rm_loc_component_cycles'[next_date] ),
BLANK (),
IF ( _day > DAY ( _eomonth ), _eomonth, DATE ( _year, _month, _day ) )
)
Best Regards