Creating % of of Total by Line

I’m new to this software, so I apologize if this question is a bit simplistic, but I’m looking to create % of total for sales by line so I can look at XYZ product and see that its 10% of sales, or whatever the correct percentage is. I’m struggling with the correct syntax to create this calculations

Hey Kyle! Welcome :slight_smile:

There’s a couple of different ways to calculate percent of total. We have a help center article that goes over the easiest methods:

which use either Table Calculations or visualization settings, so don’t require any actual LookML development. The upshot of that article is that a table calculation like

${order_items.count}/sum(${order_items.count})

will calculate the percent of total for ${order_items.count} on each row.

If you are interested in codifying the percent of total field into the LookML model, you can check out the percent_of_total measure type: https://docs.looker.com/reference/field-reference/measure-type-reference#percent_of_total.