How to calculate percent of total in looker?

How to calculate percent of total in looker?

  • Post category:Looker
  • Post last modified:February 18, 2023
  • Reading time:9 mins read

In Looker, you can calculate the percentage of total using the “percent_of_total” function. Here are the steps to calculate percent of total in Looker:

  1. Navigate to the Explore page and select the view you want to work with.
  2. Click on the gear icon at the top of the screen to open the “Explore Settings” menu.
  3. In the “Measure” section, click the “+” button to create a new measure.
  4. In the “Formula” field, enter the formula for calculating the percentage of total,
    ${measure} / ${view.measure.total} * 100
  5. Replace “measure” with the name of the measure you want to calculate the percentage for.
  6. Give your new measure a name and click “Save.”

Now, your new measure will be available in the field picker and can be used in any chart or table to show the percentage of total for the selected measure.

More Details :-

Calculating the percent of total is a common requirement in data analysis and reporting. This allows you to see the relative contribution of individual items to the overall total, giving you a better understanding of the data. In this post, we will show you how to calculate the percent of total in Looker, a powerful business intelligence and data analytics platform.

Step 1: Create a New Calculated Field

The first step in calculating the percent of total in Looker is to create a new calculated field. This field will contain the formula that calculates the percent of total for a specific field in your data. To create a new calculated field:

  1. Go to the Fields tab in your Looker project.
  2. Click on the “Create a New Field” button.
  3. Give your field a name, such as “Percent of Total Sales”.
  4. In the formula box, enter the following formula:
100 * SUM([field]) / SUM(TOTAL [field])

Replace [field] with the actual name of the field you want to calculate the percent of total for. For example, if your field is named “Sales”, the formula would be:

100 * SUM([Sales]) / SUM(TOTAL [Sales])
  1. Click on the “Create Field” button to save your calculated field.

Table Calculation in Looker

What are Derived tables in Looker?

Step 2: Add the Calculated Field to Your View

The next step is to add the calculated field to your view. This will allow you to see the percent of total in your data visualization. To add the calculated field to your view:

  1. Go to the Explore tab in your Looker project.
  2. Select the desired view from the dropdown menu.
  3. From the Fields section, drag and drop the “Percent of Total Sales” field into the View section.
  4. Optionally, you can group the view by product to see the percent of total sales for each product.

Step 3: Analyze Your Data

Now that you have added the calculated field to your view, you can use it in your data analysis and reporting. For example, you can create a bar chart to visualize the percent of total sales for each product. To create a bar chart:

  1. Go to the Visualize tab in your Looker project.
  2. Select the desired view from the dropdown menu.
  3. Choose the “Bar Chart” visualization type.
  4. In the X axis, select the “Product” field.
  5. In the Y axis, select the “Percent of Total Sales” field.

You should now see a bar chart that displays the percent of total sales for each product. You can use this chart to quickly see how each product contributes to the overall sales and make informed decisions based on the data.

Site Ref-

Conclusion

Calculating the percent of total in Looker is a straightforward process that can help you better understand your data. By creating a new calculated field and adding it to your view, you can quickly see the relative contribution of individual items to the overall total. This information can be valuable for decision-making and reporting purposes.

________________________________________________________________________________________

More Imp Topics

How Looker Writes SQL?

How to calculate percent of total in looker?

Table Calculations in Looker

What are Derived tables in Looker?

How to set conditional formatting in LOOKER?

Looker Interview Questions And Answers

New Looker Performance Recommendations Dashboard

Looker Git Version Control: How To Revert To A Specific Commit In Looker, No Git Commands Necessary

______________________________________________________________________________________

Reference :

About Me:-
I am Om Prakash Singh – Data Analytics Consultant , Looker Consultant , Solution Architect .
I am Highly analytical and process-oriented Data Analyst with in-depth knowledge of database types; research methodologies; and big data capture, manipulation and visualization. Furnish insights, analytics and business intelligence used to advance opportunity identification.

You’ve got data and lots of it. If you’re like most enterprises, you’re struggling to transform massive information into actionable insights for better decision-making and increased business results.
Reach out to us if you are interested to evaluate if Looker is right for you or any other BI solution.

This Post Has 16 Comments

Leave a Reply