Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Classification between times

Hello, i'm having trouble making a column that returns T1 T2 or T3 depending on wich time it was made

 

From 00:00 to 5:59 T3

         6:00 to 13:59 T1

         14:00 to 21:59 T2

         22:00 to 23:59 T3

         

Maybe someone can give me a light?

 

Thanks in advance !! 🙂

  • Hi Anonymous ,

     

    Try this code to create a calculated column:

     

    Column =
    VAR _time = TIME(HOUR('Table (2)'[Column1]);MINUTE('Table (2)'[Column1]); SECOND('Table (2)'[Column1]))

    RETURN IF(_time >= TIME(0;0;0) && _time <= TIME(5;59;0); "T3";
    IF(_time >= TIME(6;0;0) && _time <= TIME(13;59;0); "T1";
    IF(_time >= TIME(14;0;0) && _time <= TIME(21;59;0); "T2";
    IF(_time >= TIME(22;0;0) && _time <= TIME(23;59;0); "T3"))))
     
    Ricardo

2 Replies

  • camargos88's avatar
    camargos88
    Community Champion

    Hi Anonymous ,

     

    Try this code to create a calculated column:

     

    Column =
    VAR _time = TIME(HOUR('Table (2)'[Column1]);MINUTE('Table (2)'[Column1]); SECOND('Table (2)'[Column1]))

    RETURN IF(_time >= TIME(0;0;0) && _time <= TIME(5;59;0); "T3";
    IF(_time >= TIME(6;0;0) && _time <= TIME(13;59;0); "T1";
    IF(_time >= TIME(14;0;0) && _time <= TIME(21;59;0); "T2";
    IF(_time >= TIME(22;0;0) && _time <= TIME(23;59;0); "T3"))))
     
    Ricardo
    • Anonymous's avatar
      Anonymous
      Not applicable

      It worked ! Thanks a lot Ricardo, God Speed