Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula to select Most Recent Date Post Reply Post New Topic
Author Message
bbowen
Newbie
Newbie


Joined: 09 Apr 2014
Location: United States
Online Status: Offline
Posts: 1
Quote bbowen Replybullet Topic: Formula to select Most Recent Date
     Posted: 09 Apr 2014 at 7:52am
I am trying to write a formula that displays the MOST RECENT "Unit_Price" field (based on the "Entry_Date" field), with the condition that the price needs to correspond with an Entry_Date 6 months old or less.

The formula I wrote gives me EVERY Unit_Price where the Entry_Date is 6 m/o or less. Here's my formula:

IF {SO_DETAIL.ROUTE_CODE} = 'S'
AND {SO_DETAIL.ENTRY_DATE} in date (dateadd('m',-6,{SO_DETAIL.ENTRY_DATE})) to {SO_DETAIL.ENTRY_DATE}

THEN {SO_DETAIL.UNIT_PRICE}

How do I restrict this to only the MOST RECENT Unit_Price? I have seen someone mention the =maximum() function but I'm not sure how that works.
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 09 Apr 2014 at 11:23am
i assume there is a unit number of some sot
you could group on it then create a formula like

if your_formula <> "" and
{SO_DETAIL.ENTRY_DATE} =
= maximum({SO_DETAIL.ENTRY_DATE} , unit number) then {SO_DETAIL.UNIT_PRICE}


IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum