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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Calculation in previous row

Hello Guys i have a problem,

 

i get my data via directquery but i want to calculate everytime with previous rows. I want to get the seconds between every rows. 

mo12_0-1674492328921.png

Here is a example of it. 

Thank you for your time

4 REPLIES 4
FreemanZ
Super User
Super User

hi @Anonymous 

try to plot the date1 column with a measure like:

MinuteDuration = 
VAR _date = MAX(TableName[Date1])
VAR _datepre=
MAXX(
    FILTER(ALL(TableName), TableName[Date1]<_date),
    TableName[Date1]
)
RETURN
DATEDIFF(_datepre, _date, MINUTE)+0

it worked like this:

FreemanZ_0-1674563466270.png

 

Please ensure to feed the Date1 column directly, instead of the date hierarchy.

amitchandak
Super User
Super User

@Anonymous , You have to create a measure

 

datediff(maxx(filter(all(Table), Table[Date] < max(Table[Date]) ), Table[Date]) , Max(Table[Date]) , Second)

 

or

 

Sumx(Table, datediff(maxx(filter(all(Table), Table[Date] < max(Table[Date]) ), Table[Date]) , Max(Table[Date]) , 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
Anonymous
Not applicable

Do you know how i get this measure for only the rows that i got shown on my table and not for all of my over 1 000 000 rows?

Anonymous
Not applicable

I got this Error. 

mo12_0-1674560986896.png

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.