Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Dynamic YOY based on slicer selections

Hi, 

 

I've searched up and down for this and cannot seem to find any answer. 

 

I have a slicer in which I can choose two years, and based on those two years I want to see the YOxY % change. 

For example, if I choose 2023 and 2019 in the slicer, I want the measure to be able to calculate (latest date/earliest date)-1: 

 valueYOxY% Change
20191 
20232=(2/1)-1

 

thanks!

1 ACCEPTED SOLUTION
Subash_Govind
Frequent Visitor

Hi,
 
Below DAX Measure to achieve the above result.
 
YOY% CHANGE =
VAR Latest_Date_Sales = CALCULATE(SUM(Orders[Sales]),YEAR(Orders[Order Date]) = MAX(Orders[Order Date].[YEAR]))
VAR Earlier_Date_Sales = CALCULATE(SUM(Orders[Sales]),YEAR(Orders[Order Date]) = MIN(Orders[Order Date].[YEAR]))
VAR FINAL = ((Latest_Date_Sales/Earlier_Date_Sales)-1)
RETURN FINAL

View solution in original post

1 REPLY 1
Subash_Govind
Frequent Visitor

Hi,
 
Below DAX Measure to achieve the above result.
 
YOY% CHANGE =
VAR Latest_Date_Sales = CALCULATE(SUM(Orders[Sales]),YEAR(Orders[Order Date]) = MAX(Orders[Order Date].[YEAR]))
VAR Earlier_Date_Sales = CALCULATE(SUM(Orders[Sales]),YEAR(Orders[Order Date]) = MIN(Orders[Order Date].[YEAR]))
VAR FINAL = ((Latest_Date_Sales/Earlier_Date_Sales)-1)
RETURN FINAL

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.