Mapping Best Practices

  • 6 January 2023
  • 1 reply
  • 953 views

Userlevel 4
Badge +6

Best practices for Mapping in Pigment

In almost every Pigment model there is some kind of mapping used. Mapping is basically creating a link between 2 items (e.g. Country vs Region → France is in Europe). Mapping in Pigment can be used in different situations. A few example situations are:

  • To transform your data from a transaction list into a Metric

  • Move your data from one Metric to another Metric with different dimensionalities

  • Indicate a unique combination based on a specific context (e.g. Employee by Cost center by Month)

  • To build hierarchies 

This article describes the most common use cases for mapping and the best practices to make your modeling as efficient and simple as possible. Currently, there are 5 mapping methods described in this article. Please reply in the thread below if you have any additional questions, feedback or suggestions!


 

#

Subject

Use case example

1

Mapping 1-1 (mostly for hierarchies)

Roll up of a dimension. Country → Region or Product → Product Group

2

Mapping N-1 

Roll up from 2 (or more) dimensions into 1 (e.g. combination of Department/GL Account into P&L Account

3

Mapping in a Transaction List

Transforming data from a transaction list into Metrics to calculate, analyze and report

4

Time Dimensioned Mapping

Transforming data from a transaction list or Metric into another Metric with different dimensions where mapping can be different over time

5

Preventing unmapped items

If dimensions are updated regularly and fully automatic it can be helpful to notify any key-users that a mapping needs to be maintained

 

Table of Contents

 



 

Mapping one to one (1-1)

 

The most common use case for a mapping is a 1-1 dimension mapping. Mostly used for hierarchies (e.g. Country → Region, Product → Product Group) but it can also be used for other 1-1 mappings. In this example we’ll use a Product → Product Group mapping. There are 2 ways to do this:

 

  1. Create a mapping property inside a dimension list

  2. Create a mapping Metric 

 

Both options need to be set-up in the following way: 

  • Dimension: Product

  • Format of mapping property or Metric: Product Dimension

 

When the mapping is filled you can use it in a formula like this: 

  • Formula example: SourceMetric [BY: Product.Product Group] 

  • Source Metric dimension: Product

  • Target Metric dimension: Product Group

 

ripTYCp-5_fWnz3hgbyBfLcBy7Rqx3tNpnlpbWxEk5vR5eee3iFSwxVAMvSo0aXMxzvl_KMTr-vlpNL-UHGgG74FcrFoPUkD_9Pfs7keTHemBZZHtkkdbDspmT6LX_TfeG8ez5NTBizlTY1C6zief43lFaTvxLNk0eXqGAX9o6-ZmHj04ygF5-Fl4xn_yQ

 

There are a few reasons why a mapping in a Metric can be better than mapping directly in a dimension:

  • If you want to publish the mapping on a board (possible with a dimension but easier with a Metric)

  • If you want to apply a formula on the mapping and want to be able to override the formula

  • If you want to show the mapping inside a table alongside other Metrics

 


 

Mapping many to one (N-1) 

 

There are cases where you want to merge 2 dimensions into 1, or create a combination grid to define logic on combinations of dimension items. In this example we’ll show you how to set that up. The example we’ll use is to map data to a P&L Account based on a combination of a Department and GL Account. We want to map to a different P&L account if data is stored on a specific department. 

 

Mappings like these can’t be set-up within a dimension but always need to be set-up by using a Metric. The dimensions of the Metric will be equal to the source data. So in this case our mapping Metric has 2 dimensions: GL Account & Department. The format of the Metric will be the dimension P&L Account. 

 

WRZ3CvzpQ0WTvxZez75pV7gnLkxZz0tAq-Pdqgni7QEdCOw-iF-cY24VRX-U_cSh3-OwYHRe-MbJ-f_cgmXCzlzokGA9Tktc-A7mkSxzECHy9VXzbq-Ci70bZ9aobR9LwcaHr450SPCuV70Dux-Aeu1NTK3hhLuyYAwNgLjGgCHo-3syIDSguNSi753zqA

 

As you see in the screenshot above the 2 dimensions are pivoted in the view for readability (Department in rows, GL Account in columns). Based on the Department we want to map the revenue data to another Revenue P&L Account (Product or Other). 

This mapping can be used in a Metric by a similar way as the 1-1 mapping in section 1.

 

  • Formula example: Source Metric [BY: ‘N - 1 Mapping’]

  • Source Metric dimensions: Department & GL Account

  • Target Metric dimensions: P&L Account

 


 

N-1 mapping in a transaction list 

 

 

If you want to use a N-1 mapping with a transaction list as a source (instead of a Metric) create a property in your transaction list with the format P&L account. Connect your mapping to the transaction list property with this formula: 'N - 1 Mapping'[by: TransList.Deparment,TransList.'GL Account']

 

Now you can use this mapping as explained above in the start of section 2.


 

DcMLBS0up0MSIiXno17EXEdYjMtD2nnegerA_o70jZs7xtqZsuyC5j8QxKwIGKDA-llQ07Q5YUepmCIqa_CaWKnYNoT70UryJffyFYTjwC_dGV-A-tH0yo-BwyeSNEsHqtfe2D_dMqtrAiZPGD_2G8ezErgiOT8DXMgVusUydJwYNtMzD1KjdtSI7Ndqtw

 


 

Mapping in a Transaction List (1-1)

 

Mapping in a transaction list is very common. For example your data comes in on a product level but you want to use it on a Product Group level where you map every product in a different grouping to use in your calculations and reports. However, for visibility and drill-down functionality you want to show the product grouping in the transaction list. There are 2 ways to do this, the correct method can be chosen based on your mapping requirements: 

 

  • 1-1 mapping: create a visible property and follow the steps below

  • N-1 mapping: create a normal property directly in your transaction list. Reference it with a formula to the N-1 mapping you’ve created (How to in section 2.a of this article) 


 

QOeclYj5iyxQ8gUQBhqzdAoE07VdxKlrE4kwLsChOwAG6vMhxGbg5b8AimLjBSApvVpAU1wYjXO88aiVgBgUTyGojQDthri76Bpx1yQ9t-Sywv5JBZQR8i_kIehJby9S7xBjmqFhf7MHY9dpDmp17s0qDLMUJsCnqS26R28Rh5PH5gavms7kHpTx-0dzCQ

 

The method to create a visible property is described below:

 

  1. Create a property in your Product list with dimension type Product Grouping. In this example we’ve mapped Product 1,2 and 3 in Group A and Product 4 and 5 in Group B. 


 

Ssfr_iGnW9VLN-gF5ION6_SQxg2dtuGEnqkUwzogkXuDZUJIg4ntB59dPmFXIaV3lTaSNsGQf4qpCLD9nz9i7cC4MBTxnvJLXfCIxd07E0qCX1iz_pu4HpIgHvbZrXo-nDliuUw-Ea7yazFNInVyNmPC_y9R9So7tsivmaXm_2R5qe4Pdv72gE5fMrf8bA

 

  1. Go back to your transaction list and select the “Configure” functionality. Select the Product dimension in the sidebar and activate “Product Grouping” for the visible properties. 

 

lpq6IEcJZ7_49o120_WQ5IKiYXQwoOPWCLXuspNgFjm56fFFEgcEDZWJo4FlPZg7hNh6vwbLMoUcUTdgmNYkRdfd0yrxGVaYjZII4whaDgjQ91OCu6dQkDcm48a03PGA9vV9Xoca-oF6DPh2Bbl27RS7wjovMXDzLpfcogt6e8jh0P8yaHYLlJymUej5uw

 

  1. This will now visibly show the product grouping on every transaction item. You can achieve the same result by adding a “Normal” property in your transaction list but the method described above will be more efficient (especially for very large transactions lists) because the data doesnt “exist” on every transaction but is just shown in the front-end based on your original Product property. 

 

9P7xPMfGM8M1G1Oc8lOaNmRE4KpwBMy-RqkrN84p7UahkWyMBVIEzPin2CNxIFFbXeQSiAbum-E3Aa9ej1AyP5n1UN34cR3VdqijVgIpbtP9zOd6GzbTuGAQcuUSnrVAsJ9yO1IjsvbBE0H0CQ6sMzXzXxvwGOcqD_VebgatCPi_lifiKIozWQNwmC3pvQ

 

  1. In your formula you can still refer this mapping in your Metric with the BY modifier as in the example below. With this method you can completely “skip” the Product detail and directly show your aggregated data on the Product Grouping dimension.


 

vW3pfKcofWB4Sl2Sb_U3KNtSK-exsQDK9VzeL-Ok4ga3GVvedX96pVdesky7sf6yJNJ3ykT8B1UUURA4GFDNIyYciDdUy9ruc0yOl7aWEIvv_DOZCvDq9QkNereRanRmATVOyMzg3ZYwiLuAB6txxNy-89qpEcAn1aYGe-KHqzM9K8u7Rjwoo8quj2bgSw

 


 

Time Dimensioned Mapping

 

This article briefly explains how to use a time dimensioned mapping. A new article with more details will be published soon.

Sometimes your mapping needs to be flexible over time. For example, the way you map your Product into a Product Group can change in the future but you want to keep your historical data as it was. Pigment offers a solution for this by using a time dimensioned mapping in a Metric. Below a description of how to set this up. 

 

Note: if you want to use a time dimensioned mapping with a N-1 mapping, please read section 2 first. Then you can continue reading this section below and apply 2 source dimensions instead of 1.

 

  1. Create a Metric with a time dimension (Month) and the dimension you want to map (Product). Data type = Product Group.

 

Nmz7htv_aR2zVr_iYAPNVQC54Ew5xmLeWaW7vrxB8pTlJCxf5-cSVjDhEKamYPNBgF-Ruvs39SC0UuYNhjqvAVrT6BmxM0gDhMsCP5Jj8wEQ1KjQrwhQg2kxCyFx9LzjiEsFnR0V-zrMkeC21PzD4zHR6dcMDKhdqcvdiXZap1O82v0MSM5FIXPotn_EXg

 

  1. Turn on the override functionality for this Metric

 

5RQwP9IT0JkeKC40un7dLDUX7RQA92TqSDyvalfO3JkUKfyi9kwbsJOA12TszgOFeHEtHXgrWDrALMJtvv1leTeTCTlrH7Df5KwFE5PLWXDPm-jffiWvEomqDCZfRyUPwsM63dzRiuKs-Dhl7inpmpTggXHhjDpxzon2VvAXe6Y3YNJO0b8JrM8If19FsQ

 

  1. Apply the following formula: Previous(Month). Then fill in the mapping for the first month. This formula helps you with filling in the mapping as you only need to input it for the first month and the months that will change. Any empty month will be automatically filled by the formula based on the previous value. In this example the mapping changed from June 2023 onwards as you will see in the screenshot below. The months marked with a small yellow indicator are the ones where manual input is done (only January & June). 

 

1R9z_OZI9WBOL0p0xzqayq2VIavHS5L7eSA5dBtmD8TfyQqMc6Kj4uLeHmQ6nNWhsW7PZ5A4OSA9_0ysvHPOOvAqdEeI7QBIhwuawUUokDkSoxZDXbcUo4fSOyvEvBNgbkZxFVtuhfYtFiFGf7-tAUau4rI-p7WmBHQTLd1HFlvPbwi4Fcjr3uHUALGTfw

 

  1. Now you can use this mapping in your formula with a BY modifier. Make sure that the month dimension is available in your target Metric. E.g. when your target Metric has the dimensions Product Group and Month you can use the below formula (make sure your transaction list also has a property Month. 

 

'Example Transaction List'.Value[by:  'Example Transaction List'.Month, 'Example Transaction List'.Product; by: -> 'Time Dimensioned Mapping'; remove: Product]


 


 

Preventing Unmapped Items

 

When you use a mapping to convert your data to a different dimension one of the main vulnerabilities is that you have to maintain it. To prevent any unmapped items you can use the methodology described below to instantly see that something is not mapped correctly. In this example we have a new product that is added in our Product dimension which is not mapped yet. In Pigment, if a mapping is blank, it won’t be taken into account into your BY mapping.

 

LuxIoBct7duhb8m6qhTE9aZCUCb-KqZKhNG_vbnsmKIgGU3fcaJJSAd3K7f8UWc8jTwlirTSwJJjTrnIHv5iANbNq-hsK6r-u35g43h8IhfqoAVi7LibPIAtwQw9xtYyALnoq7JmWj66iT1AdHebckpZskTELxxemhRoPESjEdv0BgJezfa5Khg_jja2Kg


 

  1. Create a new dimension item in your “Product Group” dimension with the name “Undefined” (or something similar).

 

Q2OxDYcK7E5zITArDKrT3DlEy0EI2NxHQ1nGcFLAFLbnXrJiRvqjpn-JSHfhgDzeM7NmjI7kX1LdkPJ-I_ZUOjW3PzYNUA8vY3gYQyQ8Ysv2P9CqK6QpalMngQstUVCo8_MbgUWJOHuA5dZeunqbWDfOi3KUd05NDXmiYvSnRQFdvM9x6zdVCKDfLz0G3g


 

  1. In your original mapping in the Product dimension add another property and name it “Product Group Final”. Then apply this formula: IFBlank(Product.'Product Group','Product Group'."Undefined"). Keep the original property to enable input as you can’t override formula values in properties.

 

pZznUmcXPNKplDODFMtSMvw6mZG6gaml_D_4S52bzQ9IqgtB05nj-cWq0tF7eHYVOPR1Ig8EWIyuhCDAaIGnO1kPvZNC5C6fCtUZdGfkYT4eDAuJs7bWjRR5bFLZZWQOFl89eTJwpB8y--XJGHZzPBYY-_cji-efk2Cpe_4psdhRYXg9H4JpXafRVFQK3g

 

  1. Now use this mapping in your formulas. When a transaction is mapped to Product 6 it will automatically map to “Undefined” in the Product Group dimension and you will never miss the value in your totals. You can even make this more clear to your users by applying conditional formatting on the “Undefined” dimension item in your report.



 

F2yvwArmWrLgaHZgg4jLm6cwizHxjmUC6NSYdsq0Fx-ulC0kftCbXFWGDQbOAT4Xd7BBeb4CzUB84uwz20WOhFVwDvYyI1uW7qK9S2lAKFbOHsSiRZCG63mbKWBoKyVnDCvZGm9dGa6r1phJZGALbEcrymTdjp2i0U_Vzb0O1tfqurhcHVra9v92wDlBaw

 

The best practice here is to add a board in your application and fill it with views that are filtered and formatted on any mapping errors (e.g. blank mapping or “Undefined”). With this board you make it easy for the end-user to do a regular maintenance check on the application. E.g. you can use the Countblankof function to count any unmapped items and publish that on a board by using a KPI. 




 


1 reply

Userlevel 3
Badge +2

Thank you @Stef for this article and for such quick response to the query. This will definitely help in clearing mapping concepts.

 

 

Reply