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

Antichaos

Data Visualisation, Tableau & Data Services

  • Home
  • Services
    • Data Analysis
    • Training
    • Portfolio
  • Blog
  • Extensions
    • Tally
    • Latch
    • ———–
    • How to install
    • Licensing
    • Security and Trust
  • Tutorials
    • Stretch
    • Tempo
    • Segue
    • Orbit
    • Changing Color Palettes in Tableau
    • Allowlist a Tableau Extension
      • Atlas extension – interactive demo
    • Tableau Image Roles
    • Atlas
    • Disable Tableau Highlight – using filters
  • About Johan
  • Contact
  • Nederlands
  • Show Search
Hide Search
Home » Blog » Year-to-date in Tableau

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)))

Get more out of your data?

I'm Johan - freelance data consultant behind Antichaos Data. I help you get Tableau and data work into shape: full projects, interim support, performance tuning, dashboard redesigns, training, or just an extra pair of hands when you're stuck.

Get in touch

blog-en

Primary Sidebar

Antichaos Services

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

Recent Blogposts

  • Tableau parameters deserve better – meet Latch
  • Dashboard icons – pick one set, and use it well
  • Live News in Tableau – setup in 10 minutes
  • Stop using red vs green in dashboards
  • Tableau Toggle Button: 3 Ways to Build an On/Off Switch
  • The Tally extension: CountTo renewed
  • 5 more Tableau Desktop Tips: Fields, Calculations & Pills
  • MeasureCamp Amsterdam 2026: the power of the blank board
  • Datafam Day 2026 – Amsterdam
  • How to create pill-style navigation in Tableau

Follow & Connect on

Antichaos

Copyright © 2026 Antichaos

  • Antichaos
  • Blog
  • Tutorials
  • Privacy
  • Extensions
  • Contact