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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
hony
Frequent Visitor

How to calculate %-change to previous row with partition by (grouping)

Hi there,

 

I have to use DAX to do this:

 

For Each Group of Material (first column) I want to calculate the difference of the price compared to previous row. 

 

I tried to find a solution that is there but only found ways to do it without the partition of material (first column).

 

Thanks a lot

 

hony_0-1648642841628.png

 

1 REPLY 1
amitchandak
Super User
Super User

@hony , Try a new column like

 

New column =
var _max = maxx(filter(Table, [Material] = earlier([Material]) && [Date_eop] < earlier([Date_eop])), [Date_eop])
var _price =maxx(filter(Table, [Material] = earlier([Material]) && [Date_eop] < =_max), [price])
return
divide([price] -_price,_price)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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