Power BI DAX PREVIOUSQUARTER

The Power BI PREVIOUSQUARTER function is one of the DAX Date and Time functions useful to return a table that contains all dates from the previous quarter based on the first date of a given date. This article explains the POWER BI DAX PREVIOUSQUARTER function that accepts the dates and uses the current context to return a column of all dates from the previous quarter and the syntax is shown below.

PREVIOUSQUARTER(<dates>)

Power BI DAX PREVIOUSQUARTER function Example

To demonstrate the DAX PREVIOUSQUARTER() function, click the New Measure button on the Modeling Tab and rename it as PREVIOUSQUARTER. The below expression calculates and shows the sum of the Sales Amount of the previous quarter’s OrderDate in the FactInternetSales table. Please check the sales of the 30-01-2011 and 01-02-2011 dates. 

Here, 43,421.0364 is the January sales sum whereas the 4,69,823.9148 is the February 2011 sales. To show the same, we have added the OrderDate, Previous quarter, next quarter, next day sales, and Sales Amount to the table report. Please refer to the DateTime and function article for the remaining Power BI methods. For more Charts >> Click Here.

PreviousQuarterSales = CALCULATE(SUM(FactInternetSales[SalesAmount]), PREVIOUSQUARTER(FactInternetSales[OrderDate]))
POWER BI DAX PREVIOUSQUARTER Function 1

The below expression creates a simple measure that will calculate and show the sum of the Sales Amount of the previous OrderDate quarter of the CalendarTable generated by the CALENDAR function.

To compare both present quarter sales against the previous quarter sales, we have added the Year of OrderDate, Sales Amount, and the sum of the previous and next quarter sales to the table. For December 2010, there are no previous sales in the dataset so it returns blank.

PreviousQTRCalSale = CALCULATE(SUM(FactInternetSales[SalesAmount]), PREVIOUSQUARTER(CalendarTable[Date]))
PREVIOUSQUARTER Function 2