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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Ptolemaida
Frequent Visitor

How to calculte year on year difference

I have a table like this:

ContractDateRevenue
11/08/2025100
21/05/202420
21/05/202580
11/04/202450
31/04/202550

 

I want to calculate the difference between this year (2025) and last year (2024), using my filters. For example only for the period jan-july

 

Result should look like this (if filter month = 1 - 7)

ContractYoY
1              -50
260
350

 

Please need help with DAX Measure. thanks.

1 ACCEPTED SOLUTION
v-hashadapu
Community Support
Community Support

Hi @Ptolemaida , Thank you for reaching out to the Microsoft Community Forum.

 

We find the answer shared by @Cookistador  is appropriate. Can you please confirm if the solution worked for you. It will help others with similar issues find the answer easily.

 

Thank you @Cookistador  for your valuable response.

View solution in original post

4 REPLIES 4
v-hashadapu
Community Support
Community Support

Hi @Ptolemaida , Thank you for reaching out to the Microsoft Community Forum.

 

We find the answer shared by @Cookistador  is appropriate. Can you please confirm if the solution worked for you. It will help others with similar issues find the answer easily.

 

Thank you @Cookistador  for your valuable response.

Shubham_rai955
Super User
Super User

 

You can do this easily with a YoY (Year-over-Year) DAX measure like this:

 

 
YoY Revenue = VAR CurrentYear = YEAR(MAX('Table'[Date])) VAR LastYear = CurrentYear - 1 VAR RevenueThisYear = CALCULATE( SUM('Table'[Revenue]), YEAR('Table'[Date]) = CurrentYear ) VAR RevenueLastYear = CALCULATE( SUM('Table'[Revenue]), YEAR('Table'[Date]) = LastYear ) RETURN RevenueThisYear - RevenueLastYear
 

Important notes:

  1. Make sure you have a Date table properly marked as a date table.

  2. When you filter (for example, months 1–7), the measure will respect that automatically.

  3. Place Contract on rows and this YoY Revenue measure on values

KarinSzilagyi
Super User
Super User

Hi @Ptolemaida, try this measure 

Contract YoY = 
VAR CurrentYear =
    MAXX (
        ALLSELECTED (Contracts[ContractDate]),   
        YEAR (Contracts[ContractDate])
    )

VAR ThisYearRevenue =
    CALCULATE (
        sum(Contracts[Revenue]),
        FILTER (
            ALLSELECTED (Contracts[ContractDate]),
            YEAR (Contracts[ContractDate]) = CurrentYear
        )
    )
VAR LastYearRevenue =
    CALCULATE (
        sum(Contracts[Revenue]),
        FILTER (
            ALLSELECTED (Contracts[ContractDate]),
            YEAR (Contracts[ContractDate]) = CurrentYear - 1
        )
    )
RETURN 
    ThisYearRevenue - LastYearRevenue

KarinSzilagyi_0-1762268053460.png

 



Did I answer your question? If so, please consider marking my response as the ‘Accepted Solution’ - it helps others with the same issue find the answer more easily!
Cookistador
Super User
Super User

Hi @Ptolemaida 

 

The first step is to create a date table: to do that, create a calculate table with calendarauto()
You link your date table and the table in which you have the revenue and then, you just have to create the following measure:

 

Delta Revenue =
Var RevenueLY =
CALCULATE(
    SUM(Data[Revenue]),
    SAMEPERIODLASTYEAR('Date'[Date])
)
VAR RevenueCY =
SUM(Data[Revenue])
RETURN
 RevenueCY - RevenueLY
 
Replace Data by the name of the table in which you have the data related to the revenue, and this the result you should have:
 
Cookistador_0-1762268035947.png

 

 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.