# View: artists_perc_of_revenue

**View Name:** artists_perc_of_revenue
**Table Source:** `Derived from: Bi.Accounting_Aggregates`
**File Path:** `artists_perc_of_revenue.view.lkml`

## Overview

- **File Size:** 4942 bytes
- **Lines of Code:** 154
- **Dimensions:** 6
- **Measures:** 0
- **Dimension Groups:** 0
- **Filters:** 2

## Comments & Notes

- - measure: count
- type: count
- drill_fields: detail*

## Dimensions

| Name | Type |
|------|------|
| `artist_id` | string |
| `labelid` | string |
| `artist_total_revenue` | string |
| `running_total` | string |
| `label_total_revenue` | string |
| `perc_of_revenue` | number |

## Filters

- `activity_month_filter`
- `labelid_filter`

## Derived Table

```sql
sql: select
      z.artist_id,
      z.labelid,
      z.artist_total_revenue,
      z.running_total,
      z.label_total_revenue,
      z.running_total/nullif(label_total_revenue,0) as perc_of_revenue

      from

        (
         select
         y.labelid,
         y.artist_id,
         y.artist_total_revenue,
         c.label_total_revenue,
         (
            SELECT
            SUM(x.total_gross_revenue_usd)
            FROM
                 (
                select
                row_number() over (partition by c.labelid order by c.total_gross_revenue_usd desc) as id,
                c.labelid,
                c.artist_id,
                c.total_gross_revenue_usd
                from
                    (SELECT
                    accounting_aggregates.labelid as labelid,
                    accounting_aggregates.artistid AS artist_id,
                    COALESCE(SUM(accounting_aggregates.gross_revenue_usd), 0) AS total_gross_revenue_usd
                    FROM prod.bi.accounting_aggregates AS accounting_aggregates
                    WHERE accounting_aggregates.aggregate='Release Level'
                    and {% condition activity_month_filter %
```

