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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
batuhanbilgin3
New Member

How to calculate difference between last year for the same category?

I'm new user in powerbi and need help. Table named techniquee and has 3 columns in power bi. First column is Integer. How can I calculate the difference of each technique compared to the previous year? Result should be in Difference columns name.

YearTechniqueValueDifference(result column)
2000Agile00
2000Devops20
2001Agile1010
2001Devops1513
2002Agile5040
2002Devops8065
1 ACCEPTED SOLUTION

I found this and it works. Thank you FreemanZ.
 
Difference =
VAR current_technique = techniquee[Teknik]
VAR current_year = techniquee[Yıl]
VAR prev_year_value =
    CALCULATE (
        SUM ( techniquee[Deger] ),
        FILTER (
            techniquee,
            techniquee[Teknik] = current_technique &&
            techniquee[Yıl] = current_year - 1
        )
    )
RETURN
    IF( ISBLANK(prev_year_value), 0, techniquee[Deger] - prev_year_value )

View solution in original post

2 REPLIES 2
FreemanZ
Super User
Super User

hi @batuhanbilgin3 

try like:

DifferenceColumn =

VAR _valuepre =

MAXX(

    FILTER(

        Technique,

        Technique[Technique]=EARLIER(Technique[Technique])&&Technique[Year]<EARLIER(Technique[Year])

    ),

  Technique[Value]  

)

RETURN

[Value] - _valuepre

I found this and it works. Thank you FreemanZ.
 
Difference =
VAR current_technique = techniquee[Teknik]
VAR current_year = techniquee[Yıl]
VAR prev_year_value =
    CALCULATE (
        SUM ( techniquee[Deger] ),
        FILTER (
            techniquee,
            techniquee[Teknik] = current_technique &&
            techniquee[Yıl] = current_year - 1
        )
    )
RETURN
    IF( ISBLANK(prev_year_value), 0, techniquee[Deger] - prev_year_value )

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors