Calculating the Average Minutes and Hours Between Two Dates in Bold BI
In Bold BI, you can calculate the average number of minutes and hours between two dates using specific expressions. This can be useful in various scenarios, such as analyzing the average time taken to complete an order or task.
Calculating Average Minutes
To calculate the average number of minutes between two dates, you can use the following expression:
ABS(AVG(Convert(Decimal,DATEDIFF(MINUTE, [OrderDate], [ScanCompleteDate])))/60)*60
This expression calculates the difference in minutes between the ‘OrderDate’ and ‘ScanCompleteDate’, converts it to a decimal, and then calculates the average. The ABS function is used to ensure the result is an absolute value.
Calculating Average Hours
Similarly, you can calculate the average number of hours between two dates with a slight modification to the above expression:
ABS(AVG(Convert(Decimal,DATEDIFF(HOUR, [OrderDate], [ScanCompleteDate])))/60)*60
This expression calculates the difference in hours between the ‘OrderDate’ and ‘ScanCompleteDate’, converts it to a decimal, and then calculates the average. Again, the ABS function is used to ensure the result is an absolute value.