Forum Discussion
Datediff Formula question
- 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) )
I reward the fomula to its simplest form, Can this be done below in powe bi? I did it but got an error message.
I wanted to calculate the date difference between CREATED DATE that’s Less than or equal to (<=) 7/31/2020 and RESOLVED DATE that’s higher then (>) 7/31/2020. But if RESOLVED DATE is blank Then calculate date difference between 7/31/2020 and CREATED DATE.
Tesst 4 = DATEDIFF('FreshService RAW DATA'[Created Date] <=DATE(2020,7,31), 'FreshService RAW DATA'[Resolved Date] >DATE(2020,7,31), Day) &&ISBLANK('FreshService RAW DATA'[Resolved Date]), DATEDIFF(Date(2020,7,31), 'FreshService RAW DATA'[Created Date))
- sevenhills4 years agoSuper User
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) )