Forum Discussion
Robert4049
7 years agoFrequent Visitor
Expressions that yield variant data-type cannot be used to define calculated columns.
I'm not really sure, why this is throwing this? I'm grabbing the earliest time?
ERFTime =
IF (
COUNTROWS (
FILTER (
RELATEDTABLE ( 'Apparatus Responses' ),
'Apparatus Responses'[cancelledDateTime] <> BLANK ()
)
) = 0,
DATEDIFF (
CALCULATE (
MIN ( 'Apparatus Responses'[alarmDateTime] ),
FILTER (
'Apparatus Responses',
'Apparatus Responses'[incidentID] = 'Incident Metadata'[incidentID]
)
),
CALCULATE (
MAX( 'Apparatus Responses'[cancelledDateTime] ),
FILTER (
'Apparatus Responses',
'Apparatus Responses'[incidentID] = 'Incident Metadata'[incidentID]
)
),
SECOND
),
FALSE ()
)3 Replies
- HotChilliCommunity Champion
An IF statement has to return the same datatype from any path it follows.
That code can return different data types.
- Robert4049Frequent Visitor
Well the datediff is returning an integer?
- v-diye-msftCommunity Support
Hi Robert4049 ,
Yes, Datediff returns the count of interval boundaries crossed between two dates.
Best regards,
Dina Ye