Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowData Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more
Power BI currently does not provide a native DAX function that allows comparing month‑to‑date values with the same proportional period of the previous year. Existing time‑intelligence functions such as SAMEPERIODLASTYEAR, DATEADD, and PARALLELPERIOD always return the full month from the previous year, which creates inaccurate comparisons when the current month is still in progress.
This limitation directly affects one of the most important analytical needs in business: measuring operational and commercial performance by comparing the same period across different years.
For example, if today (or the last sales date) is May 13th, 2026, I need to compare:
May 1st–13th, 2026 with
May 1st–13th, 2025
However, SAMEPERIODLASTYEAR returns May 1st–31st, 2025, which makes the comparison invalid because the periods are not aligned. This prevents accurate performance evaluation, especially in sales, retail, finance, and operational monitoring.
Additionally, when navigating future months (e.g., June 2026), Power BI still returns values after May 13th, 2025, which should not be included because the current year has no data beyond May 13th.
Example of the measure I currently need to write to solve this manually:
M_Margem_Vs_LY_partial =
VAR MaxDataGlobal =
CALCULATE (
MAX ( fSales[Data] ),
REMOVEFILTERS ( dProdutos ),
REMOVEFILTERS ( dSubCategoriaProdutos ),
REMOVEFILTERS ( dCategoriaProdutos ),
REMOVEFILTERS ( dLojas ),
REMOVEFILTERS ( dLocalidades ),
REMOVEFILTERS ( dPromocoes )
)
VAR MaxDia =
DAY ( MaxDataGlobal )
VAR MaxMes =
MONTH ( MaxDataGlobal )
VAR MaxAnoLY =
YEAR ( MaxDataGlobal ) - 1
RETURN
CALCULATE (
[sales],
SAMEPERIODLASTYEAR ( dCalendario[Data] ),
FILTER (
ALL ( dCalendario ),
YEAR ( dCalendario[Data] ) = MaxAnoLY && MONTH ( dCalendario[Data] ) <= MaxMes
&& NOT (
MONTH ( dCalendario[Data] ) = MaxMes && DAY ( dCalendario[Data] ) > MaxDia
)
)
)
This measure works, but it is long, complex, hard to maintain, and not intuitive for most users. A native DAX function would solve this elegantly.
Introduce a new DAX function such as:
This function should:
Automatically align the previous year’s period to the same day of the current month
Prevent returning dates after the last available date of the current year
Support month, MTD, and YTD contexts
Enable accurate performance measurement for the same period across years
Eliminate the need for complex manual filtering
Improve accuracy and usability for real‑world business scenarios
Benefits:
Accurate year‑over‑year performance evaluation
Cleaner and simpler DAX
Better performance
Easier adoption by analysts and business users
Reduced risk of incorrect calculations in executive dashboards
Example:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.