Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.m3ter.com/llms.txt

Use this file to discover all available pages before exploring further.

When using a Lookup function in a Meter Derived Field calculation, the Account code string can be referenced as the key field on the published Lookup Table Revision. The previous topic set out a worked example using a Lookup table to impose variable usage discounting by country in which a customer Account is located. This topic adapts the example to illustrate how referencing the Account code string in a Derived Field calculation allows variable usage discounting to be imposed by Account:
  • Creating Lookup Table and Revision. Create and configure a Lookup Table and Revision for imposing different usage rates for billing on an account-by-account basis.
  • Setting Up Meter. Create and configure a Meter with a Derived Field calculation that uses a Lookup function referencing the Lookup Table to apply discount rates by Account to ingested usage data volumes.
  • Creating Aggregation. Target the Meter’s Derived Field and use the Aggregation to price Plans attached to Accounts.
  • Submitting Test Data and Checking Bills. Submit some sample usage data measures for test Accounts and generate sample Bills to check that different Accounts are billed according to the defined discounted usage volume measures.
Important! Before you attempt to follow this worked example, please review the earlier topics in this section: Creating and Managing Lookup Tables, Adding Data to, Publishing, and Managing Lookup Table Revisions, and Worked Example - Variable Usage Discounting.

Creating Lookup Table and Revision

We’ll first create the Disc Vol Rates Lookup Table and add Disc Vol Rates Revision 1 to it: Lookup Tables49
  • We’ve added two fields for the Table Revision schema:
Lookup Tables51
  • The Revision schema uses an account String field as the key field for Lookup and we can now add some data items for the fields:
Lookup Tables50
  • Importantly note here that we’ve entered the actual code string values for the Accounts we want to impose usage discounting on.
  • We can now publish the Table Revision:
Lookup Tables53

Setting Up Meter

Here’s the setup for VolDisc Meter 1 to serve the example discounting usage rate by Account use case: Lookup Tables52
  • A Measure Data Field called Gibs Load to collect usage volumes.
  • A DiscVol Derived Field with a calculation that uses a Lookup function referencing the Disc Vol Rates Lookup Table to apply discount rates by Account to the Gibs Load Data Field usage volumes.
When a usage data measurement is ingested for an Account using the Meter, the example Derived Field calculation takes the value of the Gibs Load Data Field and multiplies it by the number value yielded by the Lookup.findNumber() function. For the Lookup.findNumber() function used in our Derived Field calculation we have:
Lookup.findNumber("disc_vol_rates", "rate", 1, m3ter.account.code)
This will lookup the number value for the rate field in the published Disc Vol Rates Revision 1 of the Disc Vol Rates Lookup Table given the Account code string of the account keyed field, which must be present in the measurement. If no match is found for a code string, then a default value of 1 will be used for the rate. Given the data values we set up for the published Disc Vol Rates Revision 1 of the Disc Vol Rates Lookup Table:
  • If the Meter ingests a usage data measurement where the Account code string is vol_store_acct_uk, then the rate value returned by the Lookup.findNumber() function will be 0.85.
  • If the Meter ingests a usage data measurement where the Account code string is vol_store_acct_us, then the rate value returned by the Lookup.findNumber() function will be 0.95.

Creating Aggregation

Here’s the detail for a VolDisc Agg 1 Aggregation targeting the DiscVol Derived Field on VolDisc Meter 1: Lookup Table54 We can use this Aggregation as a pricing metric to price Plans attached to Accounts. Since it uses a SUM method on the Meter’s DiscVol Derived Field values, we expect that the volume charged against an Account will be for discounted usage volumes according to the rates by Account we have set up for the published Revision of the Disc Vol Rates Lookup Table.

Submitting Test Data and Checking 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. 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 DiscVol Derived Field values have been calculated correctly
  • Run billing for each Account and check they are correctly charged at the appropriate discounted rates by Account.
To test Lookup Table example:
  1. First create two test Accounts. For the current example:
  • Vol Store Acct UK with code: vol_store_acct_uk
  • Vol Store Acct US with code: vol_store_acct_us
See Creating and Managing Accounts.
  1. 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.
  2. Then use the VolDisc Agg1 Aggregation to price the Plan using a single price tier for a flat charge rate of 1 USD per GiGBites of storage used.
  3. Attach the priced Plan to each test Account.
  4. Open each Account, and submit a single sample usage data measurement of 1000 GB using VolDisc Meter 1 for a given month’s billing period. For example:
Lookup Tables56
  1. To check how the usage data measurements were ingested, you can now open Usage Data Explorer (v2) and submit a Query for the VolDisc Meter 1 and a Previous month time period for the date you made the usage submissions:
Lookup Tables57
  • In the Results row table returned for the Query, we see that for each usage measurement submitted to the two Accounts, the DiscVol Derived Field value has been correctly calculated for the Gibs Load raw volume and the rate values by Account we added to the published Disc Vol Rates Revision 1 of the Disc Vol Rates Lookup Table.
  1. 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 April, we’ll run billing to check the usage charge for the May 1st bills:
  • For Vol Store Acct UK:
Lookup Tables58
  • For Vol Store Acct US:
Lookup Tables59
As expected, each Account Bill shows that the number of units charged has been correctly adjusted for the rate by Account set using the published Disc Vol Rates Revision 1 of the Disc Vol Rates Lookup Table. By using m3ter.account.code in the Lookup function configured for the Meter Derived Field Calculation, we can quickly set up additional usage discounting for customer Accounts by simply adding their respective Account codes to the published Lookup Table Revision data.