NEXTDAY, NEXTMONTH, NEXTQUARTER, NEXTYEAR, PREVIOUSDAY, PREVIOUSMONTH, PREVIOUSQUARTER, PREVIOUSYEAR – values from previous or next time period (DAX – Power Pivot, Power BI)
This is about eight functions providing values from previous or following time period - NEXTDAY, NEXTMONTH, NEXTQUARTER, NEXTYEAR, PREVIOUSDAY, PREVIOUSMONTH, PREVIOUSQUARTER, PREVIOUSYEAR.
They work similarly, so let´s see one example. If you want to see the value for previous year, you can write something like:
-
Month ago = CALCULATE(SUM('original data'[Revenue]);PREVIOUSMONTH('original data'[Day]);ALL())
The syntax is similar to SAMEPERIODLASTYEAR. We need CALCULATE function, then some function for aggregation (like SUM...) and a column with numbers, then a function for "time traveling" and then ALL.
This is about eight functions providing values from previous or following time period - NEXTDAY, NEXTMONTH, NEXTQUARTER, NEXTYEAR, PREVIOUSDAY, PREVIOUSMONTH, PREVIOUSQUARTER, PREVIOUSYEAR.
They work similarly, so let´s see one example. If you want to see the value for previous year, you can write something like:
-
Month ago = CALCULATE(SUM('original data'[Revenue]);PREVIOUSMONTH('original data'[Day]);ALL())
The syntax is similar to SAMEPERIODLASTYEAR. We need CALCULATE function, then some function for aggregation (like SUM...) and a column with numbers, then a function for "time traveling" and then ALL.