Forum Discussion
Anonymous
4 years agoNot applicable
Datediff function seconds and minutes
Hi,
When I calculate a datediff in hours I haven't any problem:
*Countdown (hours) = IF(ISBLANK(RELATED(mysql_mail_log[created])),DATEDIFF(mysql_reports[*NU],mysql_reports[first_report_expected],HOUR))
When I try to calculate the datediff in minutes or seconds, I receive the mesage 'Can't display the visual -> OLE DB or EDBC error: [Expression.Error] We couldn't fold the expression to the data source.
*Countdown (minutes) = IF(ISBLANK(RELATED(mysql_mail_log[created])),DATEDIFF(mysql_reports[*NU],mysql_reports[first_report_expected],MINUTE))
Anyone knows what is wrong?
I'm using SQL direct query data.
6 Replies
- tamerj1
Community Champion
Anonymous
Strange that the HOUR works! Creating time related calculated columns is not allowed in direct query. You have to create measures only
- AnonymousNot applicable
how I calculate 'hh:mm' or decimal hours with only measurement and without column? I want a value for every row without a calculation like sum, average, ...
- tamerj1
Community Champion
Hi Anonymous
This might require further formattingCountdown (minutes) = VAR TimeDifference = SUMX ( mysql_reports, IF ( ISBLANK ( RELATED ( mysql_mail_log[created] ) ), DATEDIFF ( mysql_reports[*NU], mysql_reports[first_report_expected], MINUTE ) ) ) RETURN QUOTIENT ( TimeDifference, 60 ) & ":" & MOD ( TimeDifference, 60 )Would be great if you can provide sample file