Forum Discussion

bdehning's avatar
bdehning
Post Prodigy
4 years ago
Solved

Custom Column

I have a Custom Column with the following:

 

24 Hour =Time.From( Number.Round( Number.From( [Time of Incident] ) * 24 ) / 24 )

 

I need to add code to account for time that is 11:30 PM and later as it creates an error as it can not do 24:00.

 

Also I want to add,  if null then No Entry.  

 

Can I do that in Custom or can I convert Custom to Conditional Column?

  • bdehning's avatar
    bdehning
    4 years ago

    That was close.

     

    I had to use 

     

    Time.From(if Number.Round( Number.From( [Time of Incident] ) * 24.01 ) / 24=1 then 0.0 else Number.Round( Number.From( [Time of Incident] ) * 24.01 ) / 24)

     

    This allowed time under :30 to go back to the hour.  

6 Replies

  • bdehning , If data type is time, Then 24 hours display is just a display property

    or you can try like

    Time(hour([Time]), Minute([Time]), 0)

     

    If this does not help
    Can you share sample data and sample output in table format?

    • bdehning's avatar
      bdehning
      Post Prodigy

      Using 24 Hour Claims =Time.From( Number.Round( Number.From( [Time of Incident] ) * 24 ) / 24 )

       

      I get the following,  How do I account for the error because of the time that is 11:46:00?

      ā€ƒ

      • v-zhangti's avatar
        v-zhangti
        Community Support

        Hi, bdehning 

         

        You can try the following methods.

        Time.From(if Number.Round( Number.From( [Time of Incident] ) * 24 ) / 24=1 then 0.5 else Number.Round( Number.From( [Time of Incident] ) * 24 ) / 24)

        Is this the result you expect?

         

        Best Regards,

        Community Support Team _Charlotte

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.