Forum Discussion

KG1's avatar
KG1
Resolver I
5 years ago
Solved

New Column to create time bands

Hi   I need to create a new column which puts a time into a time bracket The time brackets are in hourly slots   00:00-01:00 01:00-02:00 02:00-03:00 03:00-04:00 04:00-05:00 05:...
  • Samarth_18's avatar
    5 years ago

    Hi KG1 

     

    You can create a column with below code:-

    Time_Bracket =
    VAR start_hour =
        FORMAT ( Time_Bucket[Time], "hh" )
    VAR end_hour =
        IF ( LEN ( start_hour + 1 ) = 1, "0" & start_hour + 1, start_hour + 1 )
    RETURN
        start_hour & ":00 - " & end_hour & ":00"

    Thanks

    Samarth

  • KG1's avatar
    KG1
    5 years ago

    There were some blank rows at the end of the dataset - I have removed these and it's worked perfectly

    Thank you very much for your help