Forum Discussion
Anonymous
4 years agoNot applicable
Datediff Formula question
Hi Guys, I cant get this formula to work the way I want it. This formula works perfectly but I also want it to caluclate If the resolved date is empty, I want it to calualte created date to cur...
- 4 years ago
I see you wanted to do is to calculate for those rows created date is before 7/31/2020 and resolved date is blank or after 7/31/2020.
For the rows, you want to adjust the resolved date blank as the cut off date "7/31/2020".
Tryout 2 Open Age = IF ( -- only those rows with created date <= 7/31/2020 and resolved date as blank or after 7/31/2020 ('FreshService RAW DATA'[Created Date] <= Date(2020,7,31) && ( IsBlank('FreshService RAW DATA'[Resolved Date] || 'FreshService RAW DATA'[Resolved Date] > Date(2020,7,31) ) ), DATEDIFF( 'FreshService RAW DATA'[Created Date], IF ( IsBlank('FreshService RAW DATA'[Resolved Date] ), Date(2020,7,31), 'FreshService RAW DATA'[Resolved Date] ) , DAY) )
sevenhills
4 years agoSuper User
Tryout 2 Open Age =
IF (
('FreshService RAW DATA'[Created Date] <= Date(2020,7,31)
&& IsBlank('FreshService RAW DATA'[Resolved Date]
),
DATEDIFF('FreshService RAW DATA'[Created Date], Date(2020,7,31), DAY),
DATEDIFF('FreshService RAW DATA'[Created Date], 'FreshService RAW DATA'[Resolved Date], Day)
)
Yes, it should work, I dont see any issues with it. What error you are getting?
sevenhills
4 years agoSuper User
U mean you want to check for the resolved date as either blank or has to be > Date(2020,7,31) ?
Try this and see
Tryout 2 Open Age =
IF (
('FreshService RAW DATA'[Created Date] <= Date(2020,7,31)
&& (
IsBlank('FreshService RAW DATA'[Resolved Date]
|| 'FreshService RAW DATA'[Resolved Date] > Date(2020,7,31)
)
),
DATEDIFF('FreshService RAW DATA'[Created Date], Date(2020,7,31), DAY),
DATEDIFF('FreshService RAW DATA'[Created Date], 'FreshService RAW DATA'[Resolved Date], Day)
)