# View: dt_orchgo_user_activity

**View Name:** dt_orchgo_user_activity
**Table Source:** `Derived from: Art_Relations_Prod_Art_Relations.Country, Mobile_Orchard_Prod_Android.Identifies, Orchard_App_Reporting_V2, Orchard_App_Reporting_V2.Art_Relations_Prod_Art_Relations, Segment_Events + 1 more`
**File Path:** `dt_orchgo_user_activity.view.lkml`

## Overview

- **File Size:** 4433 bytes
- **Lines of Code:** 124
- **Dimensions:** 9
- **Measures:** 1
- **Dimension Groups:** 0
- **Filters:** 0

## Dimensions

| Name | Type |
|------|------|
| `user_id` | string |
| `label_name` | string |
| `label_id` | string |
| `first_name` | string |
| `last_name` | string |
| `name` | string |
| `email` | string |
| `user_types` | string |
| `user_country` | string |

## Measures

| Name | Type |
|------|------|
| `user_event_count_sum` | sum |

## Derived Table

```sql
sql:
        select
          i.id as user_id,
          coalesce(min(v_direct.company), min(v_subaccount.company), min(v_participant.company)) as label_name,
          v_direct.vendor_id as label_id,
          i.first_name as first_name,
          i.last_name as last_name,
          i.name as name,
          i.email as email,
          i.user_types as user_types,
          min(user_events.user_country) as user_country,
          sum(user_events.user_event_count) as user_event_count_sum
        from facts.prod.identity i
        inner join
        (
          select i.id, count(*) as user_event_count, min(c.name) as user_country, min(android.profile_id) as profile_id
          from segment_events.mobile_orchard_prod_android.identifies android
          JOIN facts.prod.identity i on i.id = android.user_id
          inner join orchard_app_reporting_v2.art_relations_prod_art_relations.country c on c.country_code = substring(android.context_locale, 4, 2)

          WHERE to_date(received_at) between {% parameter filter_lower_date %
```

