Forum Discussion
siva_powerbi
Helper IV
5 years agosubtracting days from Date variable
I am trying to subtract days from date varible that I have calculated in formula but I am getting the error. An argument of function 'DATE' has the wrong data type or the result is too large or t...
- 5 years ago
Zero has the same problem as negative numbers in that there is no zeroth day of the month.
Your column definition is simpler as follows:
Column 3 = VAR firstperiod = "12/28/2020 to 01/24/2021" VAR StartDate = DATEVALUE ( RIGHT ( firstperiod, 10 ) ) VAR FP_ED = StartDate VAR FP_SD = StartDate - 27 VAR SP_SD = FP_SD - 1 VAR SP_ED = SP_SD - 27 RETURN SP_ED
siva_powerbi
Helper IV
5 years agoThanks for reply..
Negative days are being handled correctly when I do -27 I am getting 0 which is being not handled in DAX.
AlexisOlson
Super User
5 years agoZero has the same problem as negative numbers in that there is no zeroth day of the month.
Your column definition is simpler as follows:
Column 3 =
VAR firstperiod = "12/28/2020 to 01/24/2021"
VAR StartDate = DATEVALUE ( RIGHT ( firstperiod, 10 ) )
VAR FP_ED = StartDate
VAR FP_SD = StartDate - 27
VAR SP_SD = FP_SD - 1
VAR SP_ED = SP_SD - 27
RETURN
SP_ED- siva_powerbi5 years ago
Helper IV
solution is simple and working. Thanks