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

Apply final status to prior rows

Hello,

I have high transaction data (15-20 million rows) which contains status per transaction. Transactions can fail, but may eventually "Pass".

The final status is important. Failed transactions need to get tagged with Pass so they don't need triaging.

# of fails can be arbitrary so nested Previous function only goes that far. I am not sure about looping. May take too long to process large volume.

I am looking for an output with the last 2 derived fields with Final Status and Resolved Dates  based on the pass status for each Script# + Medication combo.

I am trying to get to this output. Transactions attempted = 15,  Scripts impacted = 2, Meds impacted = 3, Scripts resolved = 1

Any help is appreciated. Thanks!

 

IdTran DateScript#MedicationStatusFinal StatusResolved Date
13/10/2020 12:30AXFailPass3/10/2020 12:32
23/10/2020 12:31AXFailPass3/10/2020 12:32
33/10/2020 12:32AXPassPass3/10/2020 12:32
43/10/2020 12:33AYFailPass3/10/2020 12:37
53/10/2020 12:34AYFailPass3/10/2020 12:37
63/10/2020 12:35AYFailPass3/10/2020 12:37
73/10/2020 12:36AYFailPass3/10/2020 12:37
83/10/2020 12:37AYPassPass3/10/2020 12:37
93/10/2020 12:38BPFail  
103/10/2020 12:39BPFail  
113/10/2020 12:40BPFail  
123/10/2020 12:41BPFail  
133/10/2020 12:42BPFail  
143/10/2020 12:43BPFail  
153/10/2020 12:44BPFail  

 

Labels (1)
1 Solution

Accepted Solutions
ashishkalia
Partner - Creator
Partner - Creator

Hi @shaheermecci ,

You need to create one view where you  need to identify the max date for all the Script+Medication pair and left join it to the main table based on your Script+Medication key.

I managed to get the desired output in the attached QVW. 

Pl see and let me know if that works, in my opinion it is the only possible way to that.

 

Cheers!!

AK

*Pl mark correct if works.*

View solution in original post

1 Reply
ashishkalia
Partner - Creator
Partner - Creator

Hi @shaheermecci ,

You need to create one view where you  need to identify the max date for all the Script+Medication pair and left join it to the main table based on your Script+Medication key.

I managed to get the desired output in the attached QVW. 

Pl see and let me know if that works, in my opinion it is the only possible way to that.

 

Cheers!!

AK

*Pl mark correct if works.*