Calculate Last Year Value in DAX

How to calculate the last year value in DAX? Simply use the available DAX CALCULATE function combined with the DAX PREVIOUSYEAR function. In financial Dashboard and Reports, use the previous year value for comparison and variance calculation with the current year.

How to calculate the last year value in DAX using the PREVIOUSYEAR formula?

We can use directly the value from an existing column in our source table imported in our Model or in Power BI:

Sales Last Year := CALCULATE(SUM('ShopSales'[SalesAmount]), PREVIOUSYEAR('Time'[DateKey]))

We can also use a previously created measure and use it as a source, like in the second DAX example.

Sales Last Year := CALCULATE([Sales], PREVIOUSYEAR('Time'[DateKey]))

DAX is a Microsoft language used mainly in Power BI reports and dashboards.

Be the first to comment

Leave a Reply