Calculating the relative share over the total

Here, we will learn how to create a relative share of products over the total amount.

To start, we will add the visualization, Table chart with the dimension Product and master measure Sales $.

Follow these steps to create the visualizations:

  1. Click on the Edit button to enter the edit mode.
  2. Click on the Charts button on the asset panel, which is on the left-hand side of the screen, and find the Table chart.
  3. Click on the Table chart, and then drag and drop it into the empty space at the top of the sheet:

  1. Click on the Add dimension button and select Product in the Dimensions section.
  2. Click on the Data heading in the properties panel to expand it.
  1. Find the Add column button, click on it, and choose Measure:

  1. Select Sales $ in the Measures section:

  1. Click on the Add column button to add the second measure.
  2. Click on the fx button to open the expression editor, and then type sum(SalesAmount)/ sum(TOTAL SalesAmount) for the new measure.
  3. Click on the Apply button to close the expression editor and save the expression.
  4. In the Label of the measure, type Share %.
  5. Fix the measure Number formatting to show the number as a percentage with two decimal places:

The Table chart will look like the following screenshot:

Here, we learned how to calculate a relative share over total. In the preceding screenshot, we can see the calculation of the share ratio of each product compared to the total amount. The share is calculated within the current selection. If we select a specific country or group of products, the share-ratio calculation changes, showing the share with regards to the specific selection.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset