I am trying to calculate an annual percentage change in Power BI using DAX and need help here.
This is my data source in Power BI:
Then I calculated an average rent using this formula (for "studio" type):
AVGRentStudio = CALCULATE(AVERAGE('Rental Trend'[Rent]),'Rental Trend'[Type] = "Studio")
And I got a tabular presentation of average values:
Now I would like to calculate an annual percentage change (to the previous year).
This is what I tried, but the result isn't accurate.
RentChange =
CALCULATE (
IF (
HASONEVALUE ( 'Rental Trend'[Year] ),
DIVIDE (
SUM ( 'Rental Trend'[Rent] ),
CALCULATE (
SUM ( 'Rental Trend'[Rent] ),
'Rental Trend'[Year]
= FORMAT ( VALUES ( 'Rental Trend'[Year] ) - 1, BLANK () )
)
)
)
- 1,
'Rental Trend'[Type] = "Studio"
Can anyone help how to calculate the annual percentage change?
Thanks