Tableau error Type mismatch

The calculation contains errors

Can’t add string and datetime values

The + sign joins text only when every part is text. Your date field is a datetime, so Tableau cannot add it to a string. Convert the date to text first.

Updated · Checked on the xmetric engine

Which formula raises it, and what fixes it?

Raises the error
[Region] + ' ' + [Order Date]
Tableau: Can’t add string and datetime values

The xmetric engine rejects it too.

Fixed
[Region] + ' ' + STR([Order Date])

On each of the 3 example rows it returns:

RegionOrder DateResult
East2025-01-05 09:30:00East 2025-01-05 09:30:00
West2025-02-10 09:30:00West 2025-02-10 09:30:00
West2025-03-01 09:30:00West 2025-03-01 09:30:00

Why it works. STR() turns the datetime into text, so + can join the pieces. The date format STR produces depends on the tool and locale; use DATENAME or DATEPART pieces if you need a fixed layout.

The 3 example rows
RegionOrder Date
East2025-01-05 09:30:00
West2025-02-10 09:30:00
West2025-03-01 09:30:00

What else raises this message?

  1. Raises it

    'Ordered on ' + [Order Date]

    Fixed

    'Ordered on ' + STR(DATE([Order Date]))

    Convert the date to text before joining. DATE drops the time part first.

    Checked on the xmetric engine: the first fails, the fix runs.

  2. Raises it

    [Region] + DATETRUNC('month', [Order Date])

    Fixed

    [Region] + ' ' + STR(DATETRUNC('month', [Order Date]))

    DATETRUNC still returns a datetime, so STR comes last.

    Checked on the xmetric engine: the first fails, the fix runs.

Does my formula have this problem?

Paste your formula and run it on the example rows. It uses the fields [Region], [Order Date]; rename yours to match.

Runs in your browser on the xmetric engine. Nothing is uploaded.

Which functions does this involve?

What do people ask about this error?

How do I control how the date looks in the text?

Use DATENAME pieces, or format the field in the view instead of the formula. STR uses an ISO-like format that is the same everywhere.

Does + ever add dates?

Adding a number to a date adds days in some data sources, but DATEADD is the clear way to do it: DATEADD('day', 7, [Order Date]).

Where is this message documented?