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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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