ClearMeasure macro

The ClearMeasure macro is used to clear the data from a specified measure in a scenario for all dimensions (except period spread measures) or for a specified item, location, period or specified tag. This macro is executed at a scenario level.

For executing the macro, the value of the Command field must be specified in this format:

ClearMeasure([Measure Code], [Item Hierarchy Node], [Location Hierarchy Node], [Period label], [Tag], [Filter]) 
Note: The optional parameters are specified in [ ].

This table lists the parameters used for the macro:

Parameter Name Description
Measure Code The measure code for which the data is to be cleared.
Note: 
  • If not defined, all the available measure codes (excluding period spread measures) are considered.
  • For Transactional Data/Orders, the measure code can refer to the Source or the Destination.
Item Hierarchy Node All children entities of the passed node at the level to store scenario values.
Note: If not specified, all items are considered.
Location Hierarchy Node All children entities of the passed node at the base level.
Note: 
  • If not specified, all locations are considered.
  • For transactional data measures, the location hierarchy node refers to the Destination Location of the transactional/Order data
Period label All children entities of the passed node at the level to store scenario values. This also supports rolling period nodes.
Note: 
  • If not specified, the horizon for the cycle period including pconst is considered.
  • For transactional data measures, the period label is applied to the Delivery/End/Received Date of the transactional/Order data.
  • For Market Intelligence measures, the MI Events with start date and end date within period label, are cleared.
Tag If specified, the data of the measure with the tag is cleared.
Filter The filter criteria applied to the selected item and location (at period constant (PCONST)) at the specified Item and Location hierarchy level. The item@location (at period constant (PCONST)) which meet the filter criteria are used in clearing the measure. See, Filter Parameter syntax.

The measure values within the criteria defined by the parameters are cleared out, on successful validation and execution of the macro. For transactional data measures, the From Measure and To Measure values are cleared out and the transactional data record is deleted.

For Market Intelligence measures, the measure values are cleared and the MI Event are deleted:

Note: 
  • MI Events with Pending or Pending Delete status, wherein the user is not responsible for editing the scenario, are excluded from the data process.
  • Advanced Deleting (which includes additional filtering) of MI Events is possible using the DeleteMIEvent macro.

This table lists the examples of the ClearMeasure macro:

Requirement Syntax
Clear the measures (excluding Period Spread measure) for all items at all locations and for all periods of the cycle period horizon. ClearMeasure("","","","")
Clear the FREV measure for all items at all locations and for all periods of the cycle period horizon. ClearMeasure("FREV","","","")
Clear the measures for GOO (excluding Period Spread measure) items at all locations of the cycle period horizon. ClearMeasure("","GOO","","")
Clear the measures (excluding Period Spread measure) for all items at All DCs locations of the cycle period horizon. ClearMeasure("","","All DCs","")
Clear the measures (excluding Period Spread measure) for all items at all locations for calendar period ‘FY 10’ (at the cycle calendar level to store plans). ClearMeasure("","","","FY 10")
Clear the BREV measure for GOO items at US locations for the ‘Current Year’ (at calendar level to store scenario values). ClearMeasure("BREV","GOO","US","Current Year")
Clear measures (excluding Period Spread measure) with DPLS_AdvanceForecasting tag for all items, at all locations and for all periods of the cycle period horizon. ClearMeasure ("","","","","DPLS_AdvanceForecasting")
Clear measures (excluding Period Spread measure) with DPLS_AdvanceForecasting tag for all item/location combinations where DPLS_HUNITS > 0 for the cycle period horizon. ClearMeasure ("","","","","DPLS_AdvanceForecasting", "[DPLS_HUNITS] > 0")

Clear Transactional Data measure SPLS_PRODUCTION_PLANNED_TD for all items at all locations and for all periods of the cycle period horizon.

This clears the measure values for the two measures associated with the transactional data (SPLS_PRODUCTION_PLANNED_TD and SPLS_PRODUCTION_PLANNED_SHIFTED_TD) and the transactional data record.

ClearMeasure ("SPLS_PRODUCTION_PLANNED_TD","","","")

Clear Transactional Data measure SPLS_PRODUCTION_PLANNED_TD for all items at destination location ‘IN:B1 to F1 by Truck’ where the received date falls within the ‘FY19 M03’ bucket.

This clears the measure values for the two measures associated with the transactional data (SPLS_PRODUCTION_PLANNED_TD and SPLS_PRODUCTION_PLANNED_SHIFTED_TD) and the transactional data record.

ClearMeasure ("SPLS_PRODUCTION_PLANNED_TD","IN:B1 to F1 by Truck","FY19 M03","")
Clear the Market Intelligence measure DPLS_FMI_EVENT for all items and locations which have Events starting and ending within the period FY20 M06, deleting the measure values and the MI Event. ClearMeasure ("DPLS_FMI_EVENT","","","FY20 M06")

Validations are performed when you execute the macro. If any of the validation fails, the macro is aborted, and the related error message is displayed.

This table lists the ability to run the macro in various cycle period, scenario statuses and the validation messages:

Cycle Period Status Scenario Status Can Execute? Validation Message
Pending N/A No Cannot run macro {0} because Cycle Period has status ‘Pending’
Running WIP Yes N/A
Running Review, Rejected, Stopped, Approved, Published No Cannot run macro {0} because Scenario has status {1}
Paused Any No Cannot run macro {0} because Cycle Period is not running
Completed Any No Cannot run macro {0} because Cycle Period has status ‘Completed’
Aborted Stopped No Cannot run macro {0} because Cycle Period has status ‘Aborted’
Archived Any No Cannot run macro {0} because Cycle Period has status ‘Archived’

This table lists the error message displayed during the macro execution:

Validation Condition Error Message
Cannot pass values for both measure parameter and tag parameter in the same macro command, only one or the other can be passed. Cannot specify both measure and tag.
Check the Tag name exists and is enabled Tag {0} cannot be found.