- Setting Up a Meter. Create and configure a Meter with a Derived Field calculation that uses a Lookup function referencing the Discount Vol Rates Lookup Table to apply discount rates by country to ingested usage data volumes.
- Creating an Aggregation. Target the Meter’s Derived Field and use the Aggregation to price Plans attached to Accounts.
- Submitting Sample Data and Checking Account Bills. Submit some sample usage data measures for test Accounts and generate sample Bills to check that Accounts in different countries are billed according to the appropriate discounted usage volume measures.
Setting Up a Meter
Here’s the setup for Vol Data Meter 1 to serve the example discounting usage rate use case:
- A Measure Data Field called Gibytes Upload to collect usage volumes.
- A Dimension Data Field called Country to collect Account country.
- A Discount Volume Derived Field with a calculation that uses a Lookup function referencing the Discount Vol Rates Lookup Table to apply discount rates by country to the Gibytes Upload Data Field usage volumes.
Lookup.findNumber() function.
Lookup.findNumber() is a multi-argument function which returns a number value and is of the generalized form:
Lookup.findNumber(<table_code>, <return_field>, <default_value>, <key1>, <key2>, ...)
For the Lookup.findNumber() function used in our Derived Field calculation we have:
Lookup.findNumber("discount_vol_rates", "rate", 1, "country")
This will lookup the number value for the rate field in the published Discount Vol Rates Rev1 Revision of the Discount Vol Rates Lookup Table given the country keyed field, which must be present in the measurement. If no match is found, then a default value of 1 will be used for the rate.
Given the data values we set up for the published Discount Vol Rates Rev1 Revision of the Discount Vol Rates Lookup Table:
- If the Meter ingests a usage data measurement where the
countryis UK, then theratevalue returned by the Lookup.findNumber() function will be 0.8. - If the Meter ingests a usage data measurement where the
countryis US, then theratevalue returned by the Lookup.findNumber() function will be 0.9.
Creating an Aggregation
Here’s the detail for a Vol Data Agg1 Aggregation targeting the Discount Volume Derived Field on Vol Data Meter 1:
Submitting Sample Data and Checking Account Bills
To check our worked example of a variable discounted usage rate implemented using a Lookup Table, we’ll now submit some sample Data to two test Accounts - one based in the UK and one in the US. We can then:- Open Usage Data Explorer (v2) and perform a query to return the usage data submissions that were ingested, and to check the Discount Volume Derived Field values have been calculated correctly.
- Run billing for each Account and check they are correctly charged at the appropriate discounted rates by country.
- First create two test Accounts - one based in the UK and one based in the US. For example:
- Vol Stored UK Account
- Vol Stored UK Account
- Create a test Product, create a Product Plan Template and a Plan based on the Plan Template that uses monthly billing in arrears with US Dollars billing currency.
- Then use the Vol Data Agg1 Aggregation to price the Plan using a single price tier for a flat charge rate of 1 USD per GigaByte of storage used.
- Attach the priced Plan to each test Account.
- Open each Account, and submit a single sample usage data measurement of 1000 GB using Vol Data Meter 1 for a given month’s billing period. For example:

- To check how the usage data measurements were ingested, you can now open Usage Data Explorer (v2) and submit a Query for the Vol Data Meter 1 and a Custom time period for the date you made the usage submissions:

- In the Results row table returned for the Query, we see that for each usage measurement submitted to the two Accounts, the Discount Volume Derived Field value has been correctly calculated for the Gibytes Upload raw volume and the rate values by Country we added to the published Discount Vol Rates Rev1 Revision of the Discount Vol Rates Lookup Table.
- Lastly, run billing for each Account for the relevant month’s billing period. For the current example and having made the single 1000 GB submissions to each Account in July, we’ll run billing to check the usage charge for the August 1st bills:
- For the Vol Stored UK Account:

- For the Vol Stored US Account:

- Duplicate the published Discount Vol Rates Rev1 Revision to create a new draft Revision called Discount Vol Rates Rev2.
-
Add updated data values to the new draft Revision - for example:
- country = UK, rate = 0.85
- country = US, rate = 0.95
- Publish the new Revision.