Skip to main content

Hi all,

 

I'm trying to transform a csv file containing electric consumption data as delivered by the metering company into a file I can use in Tableau. Each line of the csv contains data for 1 day with a start date and hour (say '1 sept 2019 23:00') and then a column for each 15-minute measurement (0:00, 0:15, ... , 23:45).

After pivoting I get the start date and hour in column 1 ('1 sept 2019 23:00') and the time in column 2 (01/01/1900 00:00, 01/01/1900 0:15...). (After converting column 2 from string to date & time the date 01/01/1900 is added automatically)

I want to make the sum of both so that I get consecutive 15-minute values (1/09/2019 23:00, 1/9/2019 00:15...).

 

How to do this? Makedatetime() doesn't work because my 'date' already contains a time. Dateadd() doesn't seem to be the answer either.

 

Thanks.

3 个回答
  1. 2020年9月8日 15:30

    DATETIME(FLOAT([column 1 datetime]) + FLOAT([column 2 datetime])) should work given what you described. What this does is convert the column 1 and 2 datetime representations into numeric representations, adds them together, and then coverts the result back to a datetime.

     

    If not then a sample data set or packaged flow per Don's suggestion would be best for us to be able to help you.

     

    Jonathan

0/9000