Forum Discussion
YoY Growth % DAX Formula
- 1 year ago
Hi Trying2Excel , Thank you for reaching out to the Microsoft Community Forum.
Try below:
YoY Growth Rate =
VAR _currentYear = SELECTEDVALUE('Historical Reductions Table'[End of Month].[Year])
VAR _previousYear = _currentYear - 1
VAR _currentMonth = MONTH(MAX('Historical Reductions Table'[End of Month]))
VAR _currentYearReduction =
CALCULATE(
SUM('Historical Reductions Table'[Reduction2]),
FILTER(
ALLSELECTED('Historical Reductions Table'),
YEAR('Historical Reductions Table'[End of Month]) = _currentYear
&& MONTH('Historical Reductions Table'[End of Month]) <= _currentMonth
)
)
VAR _previousYearReduction =
CALCULATE(
SUM('Historical Reductions Table'[Reduction2]),
FILTER(
ALLSELECTED('Historical Reductions Table'),
YEAR('Historical Reductions Table'[End of Month]) = _previousYear
&& MONTH('Historical Reductions Table'[End of Month]) <= _currentMonth
)
)
RETURN
IF(
ISBLANK(_previousYearReduction) || _previousYearReduction = 0,
BLANK(),
DIVIDE(_currentYearReduction - _previousYearReduction, _previousYearReduction)
)
If your End of Month column has a date hierarchy, you can replace YEAR('Historical Reductions Table'[End of Month]) with 'Historical Reductions Table'[End of Month].[Year]' and similarly for MONTH
If this helped solve the issue, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
Hi Trying2Excel , Thank you for reaching out to the Microsoft Community Forum.
Try below:
YoY Growth Rate =
VAR _currentYear = SELECTEDVALUE('Historical Reductions Table'[End of Month].[Year])
VAR _previousYear = _currentYear - 1
VAR _currentMonth = MONTH(MAX('Historical Reductions Table'[End of Month]))
VAR _currentYearReduction =
CALCULATE(
SUM('Historical Reductions Table'[Reduction2]),
FILTER(
ALLSELECTED('Historical Reductions Table'),
YEAR('Historical Reductions Table'[End of Month]) = _currentYear
&& MONTH('Historical Reductions Table'[End of Month]) <= _currentMonth
)
)
VAR _previousYearReduction =
CALCULATE(
SUM('Historical Reductions Table'[Reduction2]),
FILTER(
ALLSELECTED('Historical Reductions Table'),
YEAR('Historical Reductions Table'[End of Month]) = _previousYear
&& MONTH('Historical Reductions Table'[End of Month]) <= _currentMonth
)
)
RETURN
IF(
ISBLANK(_previousYearReduction) || _previousYearReduction = 0,
BLANK(),
DIVIDE(_currentYearReduction - _previousYearReduction, _previousYearReduction)
)
If your End of Month column has a date hierarchy, you can replace YEAR('Historical Reductions Table'[End of Month]) with 'Historical Reductions Table'[End of Month].[Year]' and similarly for MONTH
If this helped solve the issue, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
Thank you so much for your help!