Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

SYSDATE from Oracle DB different in PowerBI

Hi,

 

The following SQL gives different answers when imported into PowerBI compared to running in a local Oracle server.  Obvisouly I am pointing the PowerBI data source at the same local database - but why is it different?

 

Power BI treats the week as Mon-Sun but my local server treats it as Sun-Sat. 

 

SELECT TO_NUMBER(TO_CHAR(SYSDATE,'D')) FROM DUAL

Please could someone explain why?

  • Hi Anonymous,

     

    Based on my research, in Oracle, you could use the NLS_TERRITORY parameter to set which day the week should start on. You can change it just for your session.

     

    Best regards,

    Yuliana Gu

3 Replies

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Microsoft Employee

    Hi Anonymous,

     

    In my test, this query returns the same answer in Oracle and Power BI desktop.

     

    Result in Oracle                                                                                 Result in Power BI desktop

     

    Are you sure the Power BI desktop is hosted in the same server where installed Oracle server? What is your desktop version? 

     

    Regards,

    Yuliana Gu

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks fo the reply v-yulgu-msft

       

      When I run this in my Oracle server I get the following (for Thursday today):

       

       

       

       

      Could it be a setting on my Oracle server end defaulting to Monday as start date for week?

       

      Thanks,

      Ben

      • v-yulgu-msft's avatar
        v-yulgu-msft
        Microsoft Employee

        Hi Anonymous,

         

        Based on my research, in Oracle, you could use the NLS_TERRITORY parameter to set which day the week should start on. You can change it just for your session.

         

        Best regards,

        Yuliana Gu