dim2mea Transformation

The dim2mea Transformation creates a new measure based on a dimension. The transformation adds the new measure column to the dataset. The transformation also preserves the dimension to ensure that lenses and dashboards don’t break if they use the dimension.

Note
Note To convert a dimension to a measure in a Data Prep recipe, see Text to Number Transformation: Convert the Column Type. To do it in a Data Prep Classic recipe, see Convert a Dimension Field Type to Measure.

During the column type conversion, the Dimension to Measure transformation rounds decimals to the nearest whole number. For example, 300.2939 becomes 300.

If the transformation cannot create a measure from a dimension, the transformation populates the measure with the specified default value. If no default value is provided, the transformation inserts ‘0.’

Example
Example

Let’s look at an example. Your Opportunity object contains a custom text field called StageVal__c, which contains the opportunity amount at a particular stage. Because this is a text field, CRM Analytics loads this data as a dimension. However, you’d like to create a measure from this dimension to enable users to perform calculations on stage amount.

You create the following dataflow definition.

{    
   "Extract_Opportunities": {        
      "action": "sfdcDigest",        
      "parameters": {            
         "object": "Opportunity",
         "fields": [                
            { "name": "Id" },                
            { "name": "Name" },                
            { "name": "Amount" },                
            { "name": "StageName" },                
            { "name": "CloseDate" },                
            { "name": "AccountId" },                
            { "name": "StageVal__c" }            
         ]  
      }    
   },    
   "Create_Measure_From_Dimension": {        
      "action": "dim2mea",        
      "parameters": {            
         "dimension": "StageVal__c",            
         "measure": "StageValue",            
         "measureDefault": "0",           
         "measureType": "long",            
         "source": "Extract_Opportunities"        
      }    
   },    
   "Register_The_Dataset": {        
      "action": "sfdcRegister",        
      "parameters": {            
         "alias": "OpportunitiesWithConvertedMeasure",            
         "name": "OpportunitiesWithConvertedMeasure",            
         "source": "Create_Measure_From_Dimension"        
      }    
   }
}
  • dim2mea Parameters
    When you define a dim2mea transformation, you set the action attribute to dim2mea and specify the parameters.