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
Aleksandra_MLT
Advocate I
Advocate I

Difference between rows based on ascending time

Hi guys I want to calculate differences between volume per ID. I have no possibility to create Index in PQ.

So for example I want the yearliest value that day for that ID to be 0, then as per example :

7.17-7.16

7.16-7.15 and so on

 

Data.PNG

2 REPLIES 2
amitchandak
Super User
Super User

@Aleksandra_MLT , Try

A new colum =

var _max = maxx(filter(Table, [Id] = earlier([ID]), [Timestamp at Datetime] <earlier([Timestamp at Datetime] )),[Timestamp at Datetime] )
return
if(isblank(_max), blank(), datediff(_max,[Timestamp at Datetime] , second))

 

or a new measure


measure =

var _max = maxx(filter(allselected(Table), [Id] = max([ID]), [Timestamp at Datetime] <max([Timestamp at Datetime] )),[Timestamp at Datetime] )
return
if(isblank(_max), blank(), datediff(_max,max([Timestamp at Datetime]) , second))

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

Thank you, @amitchandak but getting errors:

error1.PNG

 

also tried rermoving last part "

error2.PNG

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.