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
Anonymous
Not applicable

substraction in previous rows on a current filter

i am trying to subtract previous lines to get the number of seconds of two times. i always need the calculation for my selected filter as my data set is too large and an error message comes up. i always need the calculation of times for my selected view based on the filters not for the complete file.  

 

mo12_0-1679575241949.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anonymous ,

 

Here are the steps you can follow:

1. Create measure.

Measure =
var _last=
MAXX(
    FILTER(ALLSELECTED('Table'),
    'Table'[Date1]<MAX('Table'[Date1])),[Date1])
return
DATEDIFF(
    _last,MAX('Table'[Date1]),SECOND)

2. Result:

Before filtering:

vyangliumsft_0-1679883836828.png

 

After filtering:

vyangliumsft_1-1679883836830.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi  @Anonymous ,

 

Here are the steps you can follow:

1. Create measure.

Measure =
var _last=
MAXX(
    FILTER(ALLSELECTED('Table'),
    'Table'[Date1]<MAX('Table'[Date1])),[Date1])
return
DATEDIFF(
    _last,MAX('Table'[Date1]),SECOND)

2. Result:

Before filtering:

vyangliumsft_0-1679883836828.png

 

After filtering:

vyangliumsft_1-1679883836830.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Anonymous
Not applicable

can you tell me also how i can calculate the average time of the row?

 

thank you for your help

lbendlin
Super User
Super User

You would use the OFFSET function for that. Give it a try.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.