Hello
Below is sample of my table that I have in a PowerPivot model. What I'm trying to do is return the most recent "Code" associated with the particular "OrderNbr". I need this calculation as a calculated column because I'm going to use this calculated column as a filter. It gets tricky because I have some orders with the same date and unfortunately it's only at a Date level, my data doesn't include a time as well. Can this be done? Any help would be great!
Please note my data isn't sorted like the below, it is sorted randomly.
[TABLE="width: 277"]
<colgroup><col><col><col span="2"></colgroup><tbody>[TR]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 277"]
<colgroup><col><col><col span="2"></colgroup><tbody>[TR]
[TD]Date[/TD]
[TD="align: center"]OrderNbr[/TD]
[TD]Value[/TD]
[TD]Code[/TD]
[/TR]
[TR]
[TD]1/28/2016[/TD]
[TD="align: center"]39441[/TD]
[TD]$49.00[/TD]
[TD]MAN[/TD]
[/TR]
[TR]
[TD]1/22/2016[/TD]
[TD="align: center"]39989[/TD]
[TD]$38.00[/TD]
[TD]RES[/TD]
[/TR]
[TR]
[TD]1/28/2016[/TD]
[TD="align: center"]48357[/TD]
[TD]$48.00[/TD]
[TD]MAN[/TD]
[/TR]
[TR]
[TD="align: center"]1/21/2016[/TD]
[TD="align: center"]50087[/TD]
[TD]$28.00[/TD]
[TD]MAN[/TD]
[/TR]
[TR]
[TD]1/23/2016[/TD]
[TD="align: center"]50087[/TD]
[TD]$49.00[/TD]
[TD]MAN[/TD]
[/TR]
[TR]
[TD="align: right"]1/27/2016 [/TD]
[TD="align: center"]50087[/TD]
[TD]$2.00[/TD]
[TD]RES[/TD]
[/TR]
[TR]
[TD]1/27/2016[/TD]
[TD="align: center"]50087[/TD]
[TD]$9.00[/TD]
[TD]MAN[/TD]
[/TR]
[TR]
[TD]1/26/2016[/TD]
[TD="align: center"]56163[/TD]
[TD]$43.00[/TD]
[TD]MAN[/TD]
[/TR]
[TR]
[TD]1/22/2016[/TD]
[TD="align: center"]57622[/TD]
[TD]$6.00[/TD]
[TD]MAN[/TD]
[/TR]
[TR]
[TD]1/25/2016[/TD]
[TD="align: center"]62544[/TD]
[TD]$17.00[/TD]
[TD]MAN[/TD]
[/TR]
</tbody>[/TABLE]
Below is sample of my table that I have in a PowerPivot model. What I'm trying to do is return the most recent "Code" associated with the particular "OrderNbr". I need this calculation as a calculated column because I'm going to use this calculated column as a filter. It gets tricky because I have some orders with the same date and unfortunately it's only at a Date level, my data doesn't include a time as well. Can this be done? Any help would be great!
Please note my data isn't sorted like the below, it is sorted randomly.
[TABLE="width: 277"]
<colgroup><col><col><col span="2"></colgroup><tbody>[TR]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 277"]
<colgroup><col><col><col span="2"></colgroup><tbody>[TR]
[TD]Date[/TD]
[TD="align: center"]OrderNbr[/TD]
[TD]Value[/TD]
[TD]Code[/TD]
[/TR]
[TR]
[TD]1/28/2016[/TD]
[TD="align: center"]39441[/TD]
[TD]$49.00[/TD]
[TD]MAN[/TD]
[/TR]
[TR]
[TD]1/22/2016[/TD]
[TD="align: center"]39989[/TD]
[TD]$38.00[/TD]
[TD]RES[/TD]
[/TR]
[TR]
[TD]1/28/2016[/TD]
[TD="align: center"]48357[/TD]
[TD]$48.00[/TD]
[TD]MAN[/TD]
[/TR]
[TR]
[TD="align: center"]1/21/2016[/TD]
[TD="align: center"]50087[/TD]
[TD]$28.00[/TD]
[TD]MAN[/TD]
[/TR]
[TR]
[TD]1/23/2016[/TD]
[TD="align: center"]50087[/TD]
[TD]$49.00[/TD]
[TD]MAN[/TD]
[/TR]
[TR]
[TD="align: right"]1/27/2016 [/TD]
[TD="align: center"]50087[/TD]
[TD]$2.00[/TD]
[TD]RES[/TD]
[/TR]
[TR]
[TD]1/27/2016[/TD]
[TD="align: center"]50087[/TD]
[TD]$9.00[/TD]
[TD]MAN[/TD]
[/TR]
[TR]
[TD]1/26/2016[/TD]
[TD="align: center"]56163[/TD]
[TD]$43.00[/TD]
[TD]MAN[/TD]
[/TR]
[TR]
[TD]1/22/2016[/TD]
[TD="align: center"]57622[/TD]
[TD]$6.00[/TD]
[TD]MAN[/TD]
[/TR]
[TR]
[TD]1/25/2016[/TD]
[TD="align: center"]62544[/TD]
[TD]$17.00[/TD]
[TD]MAN[/TD]
[/TR]
</tbody>[/TABLE]