• Skip to primary navigation
  • Skip to main content
Antichaos

Antichaos

Tableau Consultancy & Analytics

  • Home
  • Consultancy
  • Training
  • Antichaos Blog
  • About
  • Contact
  • NederlandsNederlands
  • Show Search
Hide Search
Home » Antichaos Blog » ISO weeks in Tableau

ISO weeks in Tableau

Johan de Groot · 2017-06-30 ·

Tableau can handle all kind of dates and dateformats very well – but one option is lacking: the use of ISO8601 weeknumbers, the one which is used all over the world, especially in Europe. 

This formula will generate the right ISO weeknumber for you:

INT((Datepart('dayofyear', 
(dateadd('day',
INT(datediff('day', #1900-1-01#, [Date])/7)*7 
+ 3,#1900-1-01#))) + 6)/7)

Tableau Desktop interprets 12/31/2017 as week 53 of 2017 instead of week 1 for 2018 (per the ISO 8601 standard) – therefore you need to ‘compensate’ the year also:

If datepart('week',[Date])=53 
THEN datepart('year',[Date])+1 
ELSE datepart('year',[Date]) end

(if you want to have this resolved in Tableau itself: please vote for this must have feature on https://community.tableau.com/ideas/2992 UPDATE: this feature has been implemented in Tableau!

blog, blog-en

Want to know more?. Contact

Antichaos

Copyright © 2023 Antichaos bv