sql - Get Next Value within Row Groups in SSRS -
i have problem i'm trying solve getting nextrow value within specific rowgroup.
here's i'm trying do:
if fields!interventions.value not blank , nextrow(fields!dateoccurred.value) within group within 4 hours y else n
and column:
if fields!interventions.value not blank compare currentrow(fields!dateoccurred.value) nextrow(fields!dateoccurred.value) , display differences in hours
but i'm stuck how expression within ssrs.
i saw following question: get previous,current , next record in ssrs report in page issue 1 doesn't work row groups in ssrs.
upon further advise, appears isn't possible in ssrs, possible in query itself.
this query i'm working with:
select row_number() over(partition r.patientid, pl.chartlocationid order p.dateoccurred asc) row#, r.namefirst, r.namelast, p.dateoccurred, case p.interventions when 1 'regular analgesia' when 2 'heat pack' when 4 'cold pack' when 8 'massage' when 16 'exercise' when 32 'other' end interventions chartentry p left join chartlocation pl on p.chartlocationid = pl.chartlocationid inner join resident r on pl.residentid = r.patientid p.datedeleted null , p.dateoccurred >= '01 jul 2017' , p.dateoccurred < '01 aug 2017'
is possible achieve?
easiest , better way use lag/lead
in sql
figure out.
Comments
Post a Comment