• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Antichaos

Antichaos

Data Visualisation, Tableau & Data Services

  • Home
  • Blog
  • Services
  • Training
  • Portfolio
  • Contact
  • Nederlands
  • Show Search
Hide Search

blog-en

Year-to-date in Tableau

2017-06-30 by Johan de Groot

If you want to compare last year to this year ‘to date’, you have to take into account that a leap-year adds 1 extra date to the year – so you can’t just compare the day-of-year from this and last year.

Often this filter is used:

DATEPART('dayofyear',[Date]) <= DATEPART('dayofyear',TODAY())

But this is a better one, since this compares day and month:

YEAR([Date]) >= YEAR(TODAY())-1
AND (MONTH([Date]) < MONTH(TODAY())
OR
(MONTH([Date]) == MONTH(TODAY())
AND DAY([Date]) <= DAY(TODAY())))

If you want to have a ‘year to date’ until today (so today excluded), use this one:

YEAR([Date]) >= YEAR(TODAY()-1)-1
AND (MONTH([Date]) < MONTH(TODAY()-1)
OR
(MONTH([Date]) == MONTH(TODAY()-1)
AND DAY([Date]) <= DAY(TODAY()-1)))

Calculate last day of month

2017-06-20 by Johan de Groot

Sometimes you need to calculate how many days a certain month – like the current month. With some nested date-calculations this isn’t that hard to calculate…

[Read more…] about Calculate last day of month
  • « Go to Previous Page
  • Page 1
  • Page 2
  • Page 3

Primary Sidebar

Antichaos Services

  • Need Tableau Help ?
  • Basic, Advanced and Custom Training

Recent Blogposts

  • Smarter dashboard design – with fewer tooltips
  • Top 2000 in Perspective – Behind the Scenes
  • How to Visualize High-Value Metrics in Tableau Without Starting at Zero
  • Why is COUNTD so slow – and how can I fix this?
  • Visualizing ‘Dynamic’ Data using a Sine Wave
  • Add ‘All’ and more options to a Dynamic Parameter
  • Tableau Container Art – 4 examples of formatting dashboards without images
  • Letting Users Choose Their Visual
  • The Tableau VizQL Data Service: What It Is, What It Can Do, and When to Use It
  • Abbreviate long text in Tableau

Antichaos

Copyright © 2026 Antichaos

  • Antichaos
  • Privacy
  • Contact