6 Replies Latest reply on Apr 4, 2018 12:55 AM by Tamas Tyukos

Change date to today

Hi community,

Currently I am facing a problem, which might be easy for you, as I am still learning Tableau. I have data, which look similar as you can see below. I have IDs with different dates, and I would like to change the latest date to today's date.

I tried something like this, but this changes all the date to today, which is not good for me: If [date] < TODAY() THEN TODAY() END

IDDateSolution
12018.01.052018.04.03
12018.01.042018.01.04
12017.12.152017.12.15
12017.11.012017.11.01
12017.10.152017.10.15
22018.02.142018.04.03
22017.11.012017.11.01
22017.10.082017.10.08

Any help is appreciated!

Added red row, as my problem description was confusing

Message was edited by: Tamas Tyukos

• 1. Re: Change date to today

Hi Tyukos

Try this code:-

IF YEAR([Date])=Year(today())

THEN TODAY()

ELSE [Date]

END

Attached is the solution as well

• 2. Re: Change date to today

I understand your solution, but I think I failed to write down my problem properly. In reality there are much more date rows for one ID, I just gave a sample what it looks like.

What calculation would be good for me is the one, which only changes the latest date to today.

 1 2018.03.05 2018.04.03 1 2018.02.15 2018.02.15 1 2018.01.01 2018.01.01
• 3. Re: Change date to today

Hi ,

Use below calculation :

IF YEAR([Date])=YEAR(TODAY()) then TODAY() else [Date] END

• 4. Re: Change date to today

Hi Tamas,

Try this calculation - IIF({ FIXED [ID]: MAX(DATE([Date]))}=DATE([Date]),TODAY(),DATE([Date]))

Drag this field into your view besides ID,DATE

Remove the DATE() function if your date field is in DATE datatype already

Let me know if this works

Thanks,

Oin

2 of 2 people found this helpful
• 5. Re: Change date to today

Hi Tamas,

Is this what you want?

Let me know if this helps.

~Tushar

• 6. Re: Change date to today

This is perfect, thank you!