Forum Discussion

bgibb's avatar
bgibb
Advocate II
7 years ago
Solved

Remove seconds from time in Power Query Editor

I have a time column in an existing table. I want to remove the seconds so that it will relate to a Time table column that is in hh:mm format (no am/pm). I know this is likely easy, but I cannot figu...
  • bgibb's avatar
    bgibb
    7 years ago

    I punted on trying to change the format of the time column. 

     

    I changed my time dimension table to use seconds as the smallest grain. Doing that and then relating it to the time column in my source table did the trick.

     

    This is where I found code for a time dimension table:

     

    https://ginameronek.com/2014/10/01/its-just-a-matter-of-time-power-bi-date-time-dimension-toolkit/

     

    I changed 

     

    Source = List.Times(#time(0, 0, 0),MinuteCount, #duration(0,0,1,0)),

     

    to 

     

    Source = List.Times(#time(0, 0, 0),86400, #duration(0,0,0,1)),

     

    to get a seconds grain.

     

    Works fine, no noticible lag in performance.