The DATEDIFF functions shows the difference between two dates or times and shows the result in hours, days, months… or any other time unit you want.

For example here we have time of buying and time of selling. We want to see, how many hours was the item on stock.

The formula is like this:

  • Hours on stock = DATEDIFF(MyPreciousTable[Bought];MyPreciousTable[Sold];HOUR)