1 Reply Latest reply on Jul 23, 2013 3:09 AM by Jim Wahl

# Multi-period table calculations

Hello,

I'm trying to replicate a table that looks something like this (below) in Tableau. I've searched everywhere and can't figure out how to do it. Any ideas? Thanks.

 Sales Week to Date Month to Date Year to Date Cars \$                     25,000 \$                  325,000 \$            24,375,000 Boats \$                       6,250 \$                  162,500 \$               1,950,000 Total \$                     31,250 \$                  487,500 \$            26,325,000
• ###### 1. Re: Multi-period table calculations

You can build a measure for each period, for example:

Sales YTD =

```IF YEAR([Order Date]) == YEAR(TODAY()) AND
(MONTH([Order Date]) < MONTH(TODAY()) OR
(MONTH([Order Date]) == MONTH(TODAY()) AND DAY([Order Date]) <= DAY(TODAY())))
THEN
[Sales]
END
```

Sales MTD =

```IF YEAR([Order Date]) == YEAR(TODAY()) AND MONTH([Order Date]) = MONTH(TODAY()) AND
DAY([Order Date]) <= DAY(TODAY())
THEN
[Sales]
END
```

Sales WTD =

```IF YEAR([Order Date]) == YEAR(TODAY()) AND MONTH([Order Date]) == MONTH(TODAY()) AND
DATEPART('week',[Order Date]) == DATEPART('week', TODAY()) AND
DAY([Order Date]) <= DAY(TODAY())
THEN
[Sales]
END
```

Then add the measure values to rows, measure names to columns. ...

1 of 1 people found this helpful