Forum Discussion

HamidBee's avatar
HamidBee
Power Participant
4 years ago
Solved

How do I create a Time table using DAX?

I am working with tables that has time in 00:00:00 format. I'd like to create a Time table in this same format and use this to create a relationship with all of the other tables. I'd like it to go up in 00:00:01 increments. Does anyone have any idea on how I can create this using DAX?.

 

Thank you

  • GENERATESERIES(
            TIME(0,0,0), TIME(23,59,59), TIME(0, 0, 1) )

    but is it a good idea with 86,400 rows in the table?

3 Replies

  • HotChilli's avatar
    HotChilli
    Community Champion
    GENERATESERIES(
            TIME(0,0,0), TIME(23,59,59), TIME(0, 0, 1) )

    but is it a good idea with 86,400 rows in the table?

    • HamidBee's avatar
      HamidBee
      Power Participant

      Oh nice. First time I've come across this DAX function. True, 1 second increments doesn't sound good. If I wanted to move in 1 minute increments instead of seconds how can I rewrite the code for this?. Would I be correct in writing: 


      GENERATESERIES(
              TIME(0,0,0), TIME(23,59,59), TIME(0, 1, 0) )

      ?

      • DemoFour's avatar
        DemoFour
        Continued Contributor

        Yes that's correct, you can move the increments in the final TIME statement = H.M.S and you can change the increments to what number you want in the appropriate way.