Power BI DAX PREVIOUSDAY

The Power BI PREVIOUSDAY function is one of the DAX Date and Time functions useful to return a table that contains all the previous day’s dates based on the given date. This article explains the POWER BI DAX PREVIOUSDAY function that accepts the value of the date and uses the current context to return a column of all dates corresponding to the day previous to the first date in the given input and the syntax is shown below.

PREVIOUSDAY(<dates>)

Power BI DAX PREVIOUSDAY function Example

To demonstrate the DAX PREVIOUSDAY() function, click the New Table button on the Modeling Tab and rename it as PreviousDay. The below expression uses the FactInternetSales table. It creates a table of all the previous day’s dates to the first date in the OrderDate column. Please refer to the DAX DAY and DAX NEXTDAY functions.

To show the same, we have added the OrderDate, PREVIOUSDAY, Order Quantity, and Sales Amount to the table report. For the remaining charts, visit the Power BI Charts article.

PreviousDay = PREVIOUSDAY(FactInternetSales[OrderDate])

The PREVIOUSDAY expression below creates a simple measure. It calculates and shows the sum of the Sales Amount of the previous OrderDate day in the FactInternetSales table. To compare present-day sales against previous-day sales, we have added the OrderDate, Sales Amount, and the sum of the previous-day and next-day sales to the table.

Please refer to the list of Power BI DAX Date and Time functions and the Power BI DAX functions article available on the Power BI tutorial for beginners page for the remaining methods.

PreviousDaySales = CALCULATE(SUM(FactInternetSales[SalesAmount]), PREVIOUSDAY(FactInternetSales[OrderDate]))
POWER BI DAX PREVIOUSDAY Function