11 Replies Latest reply on Apr 17, 2018 3:27 AM by Ali Twaij

    Bug with tableau with dates in Non US regions

    Ali Twaij

      Just discovered this. If you are using operations like Datepart (DW, [some date])  (DW means day of week eg 1 for mon , 2  for Tue etc) then this will give wrong result when called by tableau. Eg if you call a stored proc or even a view that has this sql command and you want day 1 to be Monday, then with tableau calling it , it reverts to American default of day 1 being Sunday. So to overcome this you need in your stored procs to do Set Datefirst 1 at the start of the proc . This says make Monday = 1.  For views I don’t think you can over come that problem. So maybe best to convert to strored proc or not use this datepart(DW ,) type of thing.

       

      eg

      create view testview as

      select DATEPART(DW,GETDATE()) as x

       

      try running that from tableau via normal db connection and from a local sql query window on your db server. For me in uk i get 4 using tableau and 3 running it locally via a select query

       

      Applies to desktop and server. My version 10.3