Skip to Content
0

next row value

Feb 15 at 09:18 AM

41

avatar image

Hi guys

I need to compare whether previous row dt_2 = next row dt_1 then use next row dt2 as end dt for previous row dt1

I have tried relativevalue([dt_2];([ID])+1) --- but nothing is coming

I have tried to rank dt_1 and dt_2 but can't figure out how to write next row value in previous row column

I have report with below sample data:-

select '169' as ID, '1' as Ord,'169||1' as ID_Ord, '2017-12-05' as dt_1, '2017-12-10' as dt_2
union all
select '169' as ID, '3' as Ord,'169||3' as ID_Ord, '2017-12-10' as dt_1, '2017-12-15' as dt_2
union all
select '169' as ID, '11' as Ord,'169||11' as ID_Ord, '2017-12-22' as dt_1, '2018-01-01' as dt_2
union all
select '169' as ID, '13' as Ord,'169||13' as ID_Ord, '2018-01-01' as dt_1, '' as dt_2


result expected :-

select '169' as ID, '1' as Ord,'169||1' as ID_Ord, '2017-12-05' as dt_1, '2017-12-15' as dt_2
union all
select '169' as ID, '11' as Ord,'169||11' as ID_Ord, '2017-12-22' as dt_1, '' as dt_2

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Jyothirmayee A Feb 16 at 09:35 PM
0

Hi,

You can try using Previous()

=if(dt1=Previous(dt2)) then value1 else value2.

Thanks,

Jothi

Share
10 |10000 characters needed characters left characters exceeded