Calculating date from Unix Timestamp in Power Query

So, I'm trying to analyse my Google Location History. I'm loading from the Google export file, through Power Query, into a Power Pivot data model.
The file contains the datetime of each locational fix as a integer. This integer represents the milliseconds since the epoch, which is 1970-01-01:00:00:00.
In SQL, this would be straight trivial. I'd get rid of the milliseconds, and do this:
select
dateadd(second,1410907851,'1/1/1970')
 and get
2014-09-16 22:50:51.000
So, basically, I have the seconds value in the table, and I'm 'hardcoding' the epoch, but that's fine.
I'm sorry if I'm being stupid, but how on Earth do I do this in M in Power Query?

Absolutely sensational. Thanks very much Curt, I was a very long way away from working that our for myself.

Similar Messages

  • How to retrive the blob data from a table using sql query

    Hi gurus,
    I have a table which has " BLOB "content in a column .I want to view the data From BLOB column using sql query .It would be helpfull If some one share their idea.
    Regards,
    vardhani.

    You can use data templates.
    See this: http://blogs.oracle.com/xmlpublisher/entry/blob_clob_raw_and_looooong
    http://blogs.oracle.com/xmlpublisher/entry/inserting_blobs_into_your_repo
    Thanks,
    Bipuser

  • Some German alphabets are replaced by # while downloading data from UNIX

    Hi,
    I have a problem when I upload the data into UNIX application server directory, the data for example the data sent to server had some characters with german alphabets 'ä'
    '2 Jahre Erw. Gewährl.-Level HW-Rep.(11L) '.
    When I try to download the data from UNIX to a .txt file, those alphabets are replaced with '#'. The above characters has a german alphabet 'ä' which was getting replaced with '#'. So the data in the downloaded file from UNIX to a txt file would appear
    '2 Jahre Erw. Gew#hrl.-Level HW-Rep.(11L) '
    I tried to rectify the OPEN DATSET statement with the statement below
    OPEN DATASET L_UNIXFILE FOR OUTPUT IN LEGACY TEXT MODE CODE PAGE '1100'
    IGNORING CONVERSION ERRORS REPLACEMENT CHARACTER ''.
    Even after incorporating the above code in my program didn't help.
    Can any one suggest me solution.
    Regards,
    Rajesh Bhogi

    Check the codepages. If characters are replaced by '#' there is no corresponding character in the target codepage.

  • Is it possible to write an image data from unix database to windows client?

    Hello Sir/Madam,
    My database Oracle 11g resides in UNIX.  I'm trying to find out if it is possible to pull binary data from unix database and write to a file on windows7 client ?
    if so, please share that insight?
    Regards,
    Vani Sonti

    Hi,
    if you use Oracle forms 10g+ you can use the webutil to do whatever you want between db server and client pc. There are numerous examples on the net, for example:
    Zeeshan Baig's Blog: Storing and Retrieving Images / Word / Excel / PDF and Movies in Oracle Database using Forms10g

  • Reading Data from Unix file and write into an Internal table

    Dear all,
                     I am having an requirement of reading data from unix file and write the same into an internal table..how to do that ...experts please help me in this regard.

    Hi,
    do like this
    PARAMETERS: p_unix LIKE rlgrap-filename OBLIGATORY.
    DATA: v_buffer(2047) TYPE c.
    DATA: BEGIN OF i_buffer OCCURS 0,
            line(2047) TYPE c,
    END OF i_buffer.
    * Open the unix file..
    OPEN DATASET p_unix FOR INPUT IN TEXT MODE.
    <b>IF sy-subrc NE 0.
    *** Error Message "Unable to open file.
    ELSE.</b>
       DO.
         CLEAR: v_buffer.
         READ DATASET p_unix INTO v_buffer.
         IF sy-subrc NE 0.
            EXIT.
         ENDIF.
         MOVE v_buffer TO i_buffer.
         APPEND i_buffer.
      ENDDO.
    ENDIF.
    CLOSE DATASET p_unix.
    <b>Reward points if it helps,</b>
    Satish

  • The SQL statement is not valid - when importing data from SQL Server using a query

    Hi there,
    I am trying to import data from SQL to Power Pivot using a SQL query like below:
    SELECT Score.FieldCount, Score.Record.GetAt(0), Score.Record.GetAt(1),  Score.Record.GetAt(2),  Score.Record.GetAt(3),  Score.Record.GetAt(4)
    FROM 
    SELECT * FROM dbo.CLR1(
    dbo.CLR2('c:\FILES\Test.xml'), 
    'SELECT * FROM [dbo].[CXCustomer_Small]') Input
    ) Score
    And when I tried to validate it, it returns
    The SQL statement is not valid. A column name cannot be blank.
    I ran the above SQL statement in Management Studio and it works without problem. Any idea?
    Thanks!
    Chu
    -- Predict everything. http://www.predixionsoftware.com

    Never mind, I figured out - I need to give each column a name.
    -- Predict everything. http://www.predixionsoftware.com

  • Could not load data from database after adding a query

    Dear all,
    I have a working crystal reports 2011 report. This report get its data from a BW 7.01 system provided by three bex queries. Everything works as expected but not I have to add a fourth query to the report then I get the following messages:
    I try to translate it because I user the german version:
    INFORMATION: In this report a stored procedure is used. Ensure that no SQL expression was added and no grouping on server side will be done.
    WARNING: Data could not be load from the database.
    WANING: Invalid argument provided. Details: The key figure structure isn't a valid field for report generation. Use instead the real keyfigures with teir units.
    Has anyone an idea what can be the reason for my issue?
    Thanks and regards!

    hi Gerrit,
    a couple of questions...
    1) are you adding all 3 queries (and then the 4th) in the same data connection or are each of these additional queries in a subreport?
    2) if all 3 queries (and then the 4th) are in the same data connection are you linking them?
    3) most importantly, if you create a brand new report off of the 4th query, is it successful?
    it's been quite a while since I've worked with bex queries but in general adding multiple queries (or stored procs or commands or combinations thereof)  to the same report is probably not a good idea. there ends up being a lot of processing happening in the crystal reports designer itself as a large virtual record set is created by the individual queries.
    -jamie

  • Is there any statement to transfer the data from unix server to another

    Hi All,
    Is there any statement or function module avaliable in sap to transfer the data from one unix server to another unix server apart from FTP(file transfer protocol).?
    My requirement :  I need to fetch the data from one unix server to another sap server. i have a option of FTP but i need to transfer the unix data to another server internal table.
    I need to move the unix data to another sap sevrver internal table
    Regards
    Raja

    not sure what your exact requirement is, but
    if both servers are in the same system group, you could potentially just mount the unix directory from the source machine to the target with nfs mount or something.
    if not, you could consider remote function call. create a remotable function module on the source machine to read the data into an internal table, and call that function module from the target machine. this requires creating entries in the RFCDES table (i think via SM59?). on the target machine, you would call function y_whatever destination xyz, where xyz is the RFCDES you set up. it works great.
    dave

  • Load XML data from UNIX Server Directly into Relational Database Tables

    Is there a way I can load data from an XML File into Oracle Tables , without having the Input XML file in some Oracle Server Directory. My XML File resides on UNIX Application server. And I need to directly load the data into Database tables. Without loading them into the Database Directory.
    Also I am looking for a solution that would not load my Database much and effect other running processes. Can it be done using SQL Loader ?
    Oracle Database Version is : Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

    Thanks for your reply ,
    Please would you quote an Example about : 'Load the file into that table using SQL*Loader'  (From UNIX Server) Or instance of some existing thread that relates to my situation.
    The Size of the File would be about 3 GB. For a similar requirement one of my peers Code which used XMLTABLE and XPATH Approach consumed a lot of resources while running and caused the other Database Applications to slow down. Thus those guys have come up with an approach to :
            Parse XML using a C Code using some STRING Functions =>  For a CSV or Fixed width .dat file and then use SQL Loader to just load the file into Tables.
            This approach is efficient in terms of Resources and Time(Takes 5 mins). But I am not confident about parsing XML based on String based C Functions.
             Please comment about this approach . Also if possible Suggest the best efficient way of doing this.

  • Calculating date from today to after 2 years

    Hi All,
    I want to convert a date from curret value to the date 2 years after.
    How to do this.
    please reply.
    Previosly i was trying with FM  RP_CALC_DATE_IN_INTERVAL.
    But in the program it is going for dump.
    My code id:
    DATA:    gv_start_date TYPE zavlonerconttemp-created_date,
             gv_end_date TYPE zavlonerconttemp-created_date,
             c_increment VALUE 2,
             c_sign value '+' .
      gv_start_date = sy-datum.
      CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
        EXPORTING
         date            =*
         days            =*
         months          =*
         signum          = c_sign
          years           = c_increment
       IMPORTING
         calc_date       = gv_end_date
       write   gv_start_date.
       write   gv_end_date.

    CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
    EXPORTING
    date = gv_start_date  " u need to give date to which years need to be added how can u comment it.
    * days =
    * months =
    signum = c_sign
    years = c_increment
    IMPORTING
    calc_date = gv_end_date
    кu03B1ятu03B9к

  • Using data from different warehouse in a query

    Hi guys, I regularly use the query below to get stock information from SAP. However, i would like the 'on order' column to be from a different warehouse to the other data on the query.
    SELECT T0.[ItemCode], T1.[ItemName], T0.[WhsCode], T0.[OnHand], T0.[IsCommited], T0.[OnOrder], ( T0.[OnHand]- T0.[IsCommited]) 'Available to Sell', 
    t0.avgprice, t2.price 'Factory Cost Price', t2.currency 'Curr' ,
    (select rate from ortt where DATEDIFF(day, ratedate, GETDATE()) = 0 and currency = t2.currency) 'Todays Rate',
    (t2.price / (select rate from ortt where DATEDIFF(day, ratedate, GETDATE()) = 0 and currency = t2.currency)) 'GBP @ Todays Rate'
    FROM [dbo].[OITW]  T0, OITM T1, itm1 t2
    where T0.ItemCode = T1.ItemCode
    and t2.itemcode = t1.itemcode
    and t2.pricelist = 2
    and T0.WhsCode in ('pinnacle') and (t1.usertext not like N'000%' or t1.usertext is null) order by T0.ItemCode
    as you can see, the warehouse i am using is Pinnacle, but we use Transit for goods that are on order. Is it possible to isolate t0.OnOrder using brackets?
    thanks

    Groovy,
    We need to have a sub query which will be something like
    SELECT T0.ItemCode, T1.ItemName, T0.WhsCode, T0.OnHand, T0.IsCommited, T0.OnOrder, (SELECT OnOrder FROM OITW WHERE ItemCode = T0.ItemCode AND WhsCode = 'Tansit'),
    ( T0.OnHand- T0.IsCommited) 'Available to Sell',

  • Stop a calculated date from updating each time the form opens

    I have a calculated "read only" Date field, that populates the current date. how do I stop this from re-calculating the date once it is submitted?

    Hi Niall,
    Is there a way I can change this script (below) to populate the date field only if the form is "dirty", so it will automatically update once something is changed on the form. I just dont know what to put in the Javascript to make it update the date. I only know how to do it automatically in Form Calc
    Sample:
    var 
    MyDoc = event.target;MyDoc.dirty
    = true;app.exec("???");

  • Fetch data from 50  tables with single query

    Hi,
    I am having a requirement where I should fetch the records count  in a table, since there are close to 50 tables I have written below code, which is working fine with out WHERE  clause, but going to short dump if I use a where clause.
    IF NOT p_sel_opt IS INITIAL.
        LOOP AT p_sel_opt INTO wa_sel_opt .
          ASSIGN wa_sel_opt-low TO <fval>.
          ASSIGN  p_fieldname TO <field>.
          IF <field> IS ASSIGNED AND <fval> IS ASSIGNED.
            SELECT COUNT(*)  FROM (p_tabname) WHERE <FIELD>  = <fval>  .
            IF sy-subrc = 0.
              wa_fi_bukrs-bukrs = <fval>.
              wa_fi_bukrs-table =  p_tabname.
              wa_fi_bukrs-count = sy-dbcnt.
              APPEND wa_fi_bukrs TO it_fi_bukrs.
              CLEAR wa_fi_bukrs.
            ENDIF.
          ENDIF.
        ENDLOOP.
      ENDIF.
    Reason it is giving is
    <field>
    is not availble in the data base tables . what can I do to the above query for that to work.
    Thanks,
    Varun

    replace <field> with (<field>) ok?
    but, its better if you construct your where clause.. i dont know the above will work or not.
    like
    concatenate <FIELD>  ' = ' <fval> into s1 separated by space.
    and pass where (s1).
    check the FM RFC_READ_TABLE. you will get a proper picture
    Edited by: Soumyaprakash Mishra on Dec 13, 2011 11:02 PM

  • Help with displaying Date from Unix seconds

    My program receives seconds taken from a Unix system and must display them on my GUI. I realize I have to convert seconds to milliseconds for the Date, plus I take into consideration the timezone.
    My problem is that everything works correctly for time zones from GMT -1:00 all the way to GMT -12:00, but GMT time and all the zones between GMT +1:00 to GMT +12:00 display the wrong time. It varies how many hours off it is.
    Does anyone have any suggestions? I have been searching for similar issues.
    here is my code:
    static public String SecToTimeOfDay(long sec)
       SimpleDateFormat  dateFormat  = new SimpleDateFormat("HH:mm:ss");
       long timeZone  = java.util.TimeZone.getDefault().getRawOffset();
       int milli = 1000;
       String date;
       if (timeZone < 0)
          timeZone = timeZone * -1;
       //convert to seconds to milliseconds
       date = dateFormat.format(new java.util.Date((sec * milli) + timeZone));
       return date;
    }

    That is not the right way to handle time zones. Try the following and see if you're still having problems.
    static public String SecToTimeOfDay(long sec){  
        SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
        dateFormat.setTimeZone(java.util.TimeZone.getDefault());
        int milli = 1000;
        date = dateFormat.format(new java.util.Date(sec * milli));
        return date;
    }

  • How to retrieve data from iMac g5-no power supply

    Hello all,
    I have a iMac g5 that the power supply is shot. The computer no longer goes on. The software is OS X (tiger) 10.4. I took my computer to apple and because if the age of the computer they are not able to fix it. However I do have a lot of pictures and my graphic stuff, as well as music. U
    Is there a way to pull the data using perhaps an external hard drive or a pc? If so how can it be done.
    It would mean a lot to me. Please help
    Serena23

    But how to I retrive the info once the harddrive is removed
    call OWC to find out what type of encloser you need.  will need both your new computer & old hd in hand.  ( actually, owc may be able to tell you what encloser you need before you get the old hd in hand.  Call. )
    $ get some use on your credit card.
    plug old drive into new enclosure ( call owc for help if needed. )
    plug new encloser into new computer. 
    hd icon will appear on desktop.  double click on hd icon to begin.
    & you can now backup you new computer hd to old drive.  Best to buy new drive & backup to new drive in encloser
    Robert

Maybe you are looking for

  • Can you use a php variable to filter a recordset?

    I've got a table of 'events', which have a description and more importantly for this a month ID number. (1-12 for the months of the year, when the event takes place) . I've used php's date function on a page to fund out numerically what month it is n

  • Don't know what to do or who to ask??? GPS stopped working after 4.4.2 Kitkat update.

    Don't know what to do or who to ask??? GPS stopped working after 4.4.2 Kitkat update. I have been on the phone multiple times with Verizon, visited multiple stores and still getting different answers with every different person I talk to... Since the

  • Custom tab order Acrobat Pro 8.0

    I just switched from Acrobat Pro 7.0 to 8.0 and I'm already lost. I have forms that have a hundred form fields on each page, and I need to set them to tab in a specific order. When I used Pro 7.0 it was a simple matter to skip any form field which di

  • Is an imac right for me?

    Hi there. I currently have a black 13" macbook that has introduced into the world of mac!! However, I am considering purchasing an imac, more than likely one of the 17" or 20" models. I have a couple of questions that I hope people can answer for me

  • Tables: Fit Content to Frame

    (InDesign CS2) Since "fit frame to content" is available when you select a frame that contains a table, but "fit content to frame" is not...I'm assuming it's not possible to do that. I understand that a table can lie well within or outside of its fra