Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Calculation based on Lookup code

Hello All,

We have many records in the DB for Look up code & VIN. EVtrip Dist & Trip Length are direct fields available in the DB.

I need to first calculate Avg EVtrip distance, Weekly average, EEMD & Cumulative EEMD based on millions of records.

How to do calculate considering 'N'  no of records and because i need to compare, not next or previous records but several records between.

Please find the sample data.

Cumulative Estimated EMD

Sold in week

Wk

LOOKUPCODE

VIN

EV

TRIP

DIST

TRIP

LENGTH

Avg EV Trip Distance

Wkly Avg

EEMD

Cumulative EEMD

Week 1

80

Wk1

TRIP_INFO_ALERT

1FADP5CU5DL525753

114

251

214

165.75

13260

13260

TRIP_INFO_ALERT

1FADP5CU5DL525753

100

120

TRIP_INFO_ALERT

3FA6P0PU6DR310101

63

102

63

TRIP_INFO_ALERT

1FADP5CU8DL555376

120

215

120

TRIP_INFO_ALERT

3FA6P0SU1DR332367

266

780

266

(165.75 *80)

Week 2

100

Wk2

TRIP_INFO_ALERT

1FADP5CU5DL525753

97

97

97

88.5

15930

29190

TRIP_INFO_ALERT

3FA6P0PU6DR310101

131

200

131

TRIP_INFO_ALERT

1FADP5CU8DL555376

39

39

39

TRIP_INFO_ALERT

3FA6P0SU1DR332367

87

87

87

Actual Number of vehicles that have been sold per that week

(88.5 *180)

(13260+15930)

Week1  -- Cumulative Estimated EMD = 13260
Week2  -- Cumulative Estimated EMD = 29190

Former Member
Not what you were looking for? View more on this topic or Ask a question