Forum Discussion

android1's avatar
android1
Icon for Post Patron rankPost Patron
10 years ago
Solved

Count occurrence of time

Hi I have 2  columns in date time format which show appointment times.

I need to count the number of times an appointment occurs between 7am-8am etc. 

 

I would like not to have to change the format to time if possible.

 

 

 

  • android1 Create calculated column as below replacing 'sam' with your table name. Then use sum of new column to get count of times where time is between 7 and 8.

     

    Column = IF(HOUR(sam[timefrom]) >= 7 && HOUR(sam[timeto]) <= 8,1,0)

2 Replies

  • ankitpatira's avatar
    ankitpatira
    Icon for Community Champion rankCommunity Champion

    android1 Create calculated column as below replacing 'sam' with your table name. Then use sum of new column to get count of times where time is between 7 and 8.

     

    Column = IF(HOUR(sam[timefrom]) >= 7 && HOUR(sam[timeto]) <= 8,1,0)

    • android1's avatar
      android1
      Icon for Post Patron rankPost Patron

      Thank you. Does exactly what I need.