How to sum the last 7 days of the value from orders? ( Data set used:  Global superstore 2016)

Mar 12, 2019 in Tableau 16,836 views

## 1 answer to this question.

It can be achieved easily by creating a calculated field, here is how it goes:

1. Create a calculated field :
2. Use calculation:

SUM(IIF(DAY(TODAY())-DAY([Order Date]) <=6, [Sales], 0))

3. Then you will get the sum of last 7 days as wanted.

Hope this helps you.

For an in-depth explanation check out Tableau Training Course details.

answered Mar 12, 2019 by
• 33,030 points

## How to color code cells of a column based on the text value in Tableau

You can use the following steps to ...READ MORE

## How to calculate the percent of records within a group in tableau?

You can click the measure SUM(Number of Records) and ...READ MORE

## How to count occurrence of value and percentage of a subset in tableau public?

Although it sounds like a fairly easy ...READ MORE

## How to add grand totals of the bar in Stacked Bar in Tableau

Hi Grim, As you have used reference line ...READ MORE

## Calculated filed with if-then

Below is the required code:  IF (NOT ISNULL([test2])) ...READ MORE

## How to calculate profit when cost and revenue are in same column?

You can create the following calculated fields: Profit: SUM(IIF([account_category] ...READ MORE

## Creating a calculated field with LOD expression

Go ahead and try the following three ...READ MORE

## Calculation issue: Distinct sum in Tableau

I feel the easiest way is to ...READ MORE