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
mo12
Frequent Visitor

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 @mo12 

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

@mo12 , 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) )

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?

I got this Error. 

mo12_0-1674560986896.png

 

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.

Top Solution Authors