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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
jonbrooker
Helper I
Helper I

Calculating difference from previous year by area

Hi, I wonder if anyone can help me with what I was hoping would be a relatively common calculation, but I've so far failed to find a solution.

I need to calculate the difference in [Value] from the previous year, with the calculation resetting with the area name. An example of the data structure is shown below. I am trying to get PowerBI to calculate the 'Difference from previous year' column to get the values shown.

 

AreaYearValueDifference from previous year
Area 120155001 
Area 1201662001199
Area 120174980-1220
Area 120182634-2346
Area 1201952842650
Area 120206114830
Area 1202172131099
Area 120226003-1210
Area 220151984 
Area 220162103119
Area 22017211512
Area 220182301186
Area 220192286-15
Area 220202199-87
Area 220212311112
Area 22022238574
Area 320157150 
Area 32016718535
Area 32017723348
Area 320187345112
Area 320197534189
Area 320207684150
Area 32021769915
Area 32022774243

Any help gratefully received!

1 ACCEPTED SOLUTION
ThxAlot
Super User
Super User

ThxAlot_0-1716522970627.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



View solution in original post

3 REPLIES 3
jonbrooker
Helper I
Helper I

Thank you both so much for replying.

 

I couldn't get the solution by Kaviraj11 to work (presumably my fault), but the code supplied by ThxAlot worked a treat and I've been able to apply it to my real-life data. Excellent stuff!

ThxAlot
Super User
Super User

ThxAlot_0-1716522970627.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



Kaviraj11
Super User
Super User

Hi,

 

To work with time intelligence function, we must have a date/calendar table. Make sure to have it created and relationship is created. Additionally, use the Year column(hierarchy) from the  Date column of Date/Calendar Table

 

Next, you create a previous year value/data as:

 

Previous Year  =
VAR PREVIOUS=CALCULATE(SUM(Table[Value]),PREVIOUSYEAR('Calendar'[Date].[Date]))
RETURN IF(ISBLANK(PREVIOUS),0,PREVIOUS)
 
Second Measure:
Difference = SWITCH(TRUE(),[Previous Year]=0,BLANK(),CALCULATE(SUM(Table[Value])-[Previous Year)
 
 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors