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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Syndicate_Admin
Administrator
Administrator

Calculate New Column Using Field in the Previous and Subsequent Row

Good

I need to create a measure to calculate the "Treatment" field of each row taking into account the ticket field of the previous and subsequent rows, and that a filter is performed with the next measure, showing the results that are 1.

filtro_informe_pendientes =
YES (
( SELECTEDVALUE ( 'public h_cercoer_pendings' [date] ) >= 'Date' [fecha_minima] && SELECTEDVALUE ( 'public h_cercoer_pendings' [date] ) < 'Date' [fecha_maxima] );
1 ;
0
)

fjgarcia85_0-1713528922578.png

Best regards

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

Thanks for the quick response.

Hi @Syndicate_Admin ,

I have some information to add.

I have create a simple sample, please refer to my post to see if it helps you.

Measure = var _above=CALCULATE(MAX('Table'[Index]),FILTER(ALL('Table'),'Table'[Index]<SELECTEDVALUE('Table'[Index])))
var _abovere=CALCULATE(MAX('Table'[fecha]),FILTER(ALL('Table'),'Table'[Index]=_above))
var _below=CALCULATE(MIN('Table'[Index]),FILTER(ALL('Table'),'Table'[Index]>SELECTEDVALUE('Table'[Index])))
var _belowve=CALCULATE(MAX('Table'[fecha]),FILTER(ALL('Table'),'Table'[Index]=_below))
return 
IF(MAX('Table'[fecha])>=_abovere&&MAX('Table'[fecha])<=_belowve,1,0)

 

vrongtiepmsft_0-1713767109723.png

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

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

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

Thanks for the quick response.

Hi @Syndicate_Admin ,

I have some information to add.

I have create a simple sample, please refer to my post to see if it helps you.

Measure = var _above=CALCULATE(MAX('Table'[Index]),FILTER(ALL('Table'),'Table'[Index]<SELECTEDVALUE('Table'[Index])))
var _abovere=CALCULATE(MAX('Table'[fecha]),FILTER(ALL('Table'),'Table'[Index]=_above))
var _below=CALCULATE(MIN('Table'[Index]),FILTER(ALL('Table'),'Table'[Index]>SELECTEDVALUE('Table'[Index])))
var _belowve=CALCULATE(MAX('Table'[fecha]),FILTER(ALL('Table'),'Table'[Index]=_below))
return 
IF(MAX('Table'[fecha])>=_abovere&&MAX('Table'[fecha])<=_belowve,1,0)

 

vrongtiepmsft_0-1713767109723.png

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

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

 

 

 

 

Anonymous
Not applicable

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.