Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi Community,
I hope you can help me with this issue - thanks in advance!
Context: I want to calculate the % difference in values between 2 years when we select one year in the slicer
My DAX code so far (cannot display Prior Year values as attached image):
@MichaelZang , Try using
dax
UOM_Selected_Year =
CALCULATE(
SELECTEDVALUE(financial[UOM %]),
FILTER(dim_time, dim_time[year] = SELECTEDVALUE(dim_time[year]) &&
(dim_time[period] = "FY" || dim_time[period] = "H1")),
FILTER(dim_region, dim_region[region_name] = "Global")
)
UOM_Prior_Year =
VAR SelectedYear = SELECTEDVALUE(dim_time[year])
VAR PriorYear = SelectedYear - 1
RETURN CALCULATE(
SELECTEDVALUE(financial[UOM %]),
FILTER(dim_time, dim_time[year] = PriorYear &&
(dim_time[period] = "FY" || dim_time[period] = "H1")),
FILTER(dim_region, dim_region[region_name] = "Global")
)
UOM_difference =
VAR UOM_Selected_Year_Value = [UOM_Selected_Year]
VAR UOM_Prior_Year_Value = [UOM_Prior_Year]
RETURN IF(
NOT ISBLANK(UOM_Selected_Year_Value) && NOT ISBLANK(UOM_Prior_Year_Value),
DIVIDE(UOM_Selected_Year_Value - UOM_Prior_Year_Value, UOM_Prior_Year_Value) * 100,
BLANK()
)
Proud to be a Super User! |
|
Hi @bhanu_gautam, I tried your code, but unfortunately, it doesn't work. It doesn't display the values
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!