Home » DAX » DAX – PREVIOUSDAY Function

# DAX – PREVIOUSDAY Function

Returns a table that contains a column of all dates representing the day that is previous to the first date in the dates column, in the current context.

It comes under Time & Intelligence Dax function Category.

#### Syntax:

`PREVIOUSDAY(<dates>)`

#### Description:

Dates – A column with dates.

#### Note:

This function determines the first date in the input parameter, and then returns all dates corresponding to the day previous to that first date.

For example, if the first date in the dates argument refers to Sept 13, 2020; this function returns all dates equal to Sept 12, 2020.

Step-1: Create a measure to calculate previous day sale.

```PREVIOUSDAY =
CALCULATE(SUM(Orders[Sales]),
PREVIOUSDAY(Orders[Order Date]))```

Step-2:  Drag Order Date, Sales & Previous Day measure to table visual to check the output.

Previousday DAX Output – 1

So, you can see here it returns the previous day sales against current date.

Points to remember here:

If some dates are missing in your dataset, then it will return blank as in previous sales value.

Here, 03/04/2020 Order date is missing so, it return blank sales value against 04/04/2020.

Previousday DAX -2

Step-3: Drag one more Region column in table visual and see the change behavior-

Now, it is showing region wise previous day sales, you can see in below screen shot, for Central – 01/01/2015 sales is 36.58, so it will return same sales for Central – 02/01/2015 & same for other regions.

Previousday DAX-3

Recommended Post : PREVIOUSMONTH DAX Function

Hope you enjoyed the post. Your valuable feedback, question, or comments about this post are always welcome or you can leave us message on our contact form , we will revert to you asap.

## 1 thought on “DAX – PREVIOUSDAY Function”

1. So, how to get the previous day value – let’s say, I want to show on day 4, the value for day 2, when there’s no day 3 available?

I am struggling with this and cant find a solution other than working around the excel file instead.