QuestionQ24

VerifiedScripting and Automation

A developer needs to aggregate monthly energy-usage data across a four-month period for each subscriber in an email. The monthly usage values are stored in variables for each month as follows:

SET @jan = LOOKUP("energyusage","jan","subscriber_key",_subscriberKey)

How should AMPscript be used to produce the total?

Explanation

The AMPscript Add() function returns the sum of exactly two numbers. Nesting Add() calls supplies two operands at every level and calculates all four monthly values as a single total.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!