<!-- https://learnsql.cpetoday.com/functions/dax/previousday -->
# PREVIOUSDAY

Language: DAX
Category: Time intelligence: shift and compare
Syntax: PREVIOUSDAY(<dates>)
Summary: Returns the calendar day before each date in the filter context.
Returns: A table of dates.
Level: Intermediate
Related: NEXTDAY, DATEADD, PREVIOUSMONTH, CALCULATE, LASTDATE

## What it does
PREVIOUSDAY moves the visible date back one calendar day. Finance teams use it to show the cash position at the close of the previous day, to compare today's receipts with yesterday's, and to pull opening balances for a daily cash report. It works on calendar days, so it does not skip weekends or bank holidays.

## Syntax and arguments
- dates: the date column of the Calendar table. Required.

## Example
A daily cash report shows the bank balance at the end of the previous day, next to the balance for the current day. The balances are in a daily snapshot table related to the Calendar.

```dax
Cash Balance Prior Day =
CALCULATE(
    SUM('Bank_Balances'[Balance]),
    PREVIOUSDAY('Calendar'[Date])
)
```

On a Tuesday, the measure returns the balance for Monday. On a Monday, it returns the balance for Sunday, and the bank may not have posted anything that day. For the last business day, use a workday flag in the filter.

## Example: a second, different use
The receipts from the previous day, for a collections call list that reviews yesterday's cash.

```dax
Receipts Prior Day =
CALCULATE(
    SUM('Payments'[Amount]),
    PREVIOUSDAY('Calendar'[Date])
)
```

## Things to watch
- PREVIOUSDAY returns the calendar day before, not the previous business day. A Monday's previous day is a Sunday.
- For a balance snapshot, a missing day in the snapshot table returns a blank. Check that every day has a row, or use a last-non-blank pattern.
- The Calendar must be complete, and the date column must have no time part.
- For a previous business day, add a workday flag to the Calendar and filter on it, as shown in the WEEKDAY reference.

## In business terms
PREVIOUSDAY supports daily cash reporting, opening balances for the day, yesterday's receipts and payments, and day-over-day exception checks. Treasury teams use it to start each morning from a known position.
