# View: cm_social_current

**View Name:** cm_social_current
**Table Source:** `INTELLIGENCE.DBT_PROD.CM_SOCIAL_CURRENT`
**File Path:** `cm_social_current.view.lkml`

## Overview

- **File Size:** 4053 bytes
- **Lines of Code:** 132
- **Dimensions:** 2
- **Measures:** 10
- **Dimension Groups:** 0
- **Filters:** 0

## Comments & Notes

- derived_table: {
- sql: with current_socials as (
- #select a.name as name, s.account_id as account_id, max(ig_followers) as current_ig_followers, max(fb_likes) as current_fb_likes,

## Dimensions

| Name | Type |
|------|------|
| `name` | string |
| `account_id` | string |

## Measures

| Name | Type |
|------|------|
| `current_ig_followers` | max |
| `ig_follower_change` | max |
| `current_fb_likes` | max |
| `fb_likes_change` | max |
| `current_tw_followers` | max |
| `tw_followers_change` | max |
| `current_tiktok_followers` | max |
| `tiktok_followers_change` | max |
| `current_youtube_views` | max |
| `youtube_views_change` | max |

## Derived Table

```sql
#    sql: with current_socials as (
#
#select a.name as name, s.account_id as account_id, max(ig_followers) as current_ig_followers, max(fb_likes) as current_fb_likes,
#max(tw_followers) as current_tw_followers, max(tt_followers) as current_tiktok_followers, max(yt_views) as current_youtube_views
#from INTELLIGENCE.DBT_PROD.CM_SOCIAL_UNION s
#left join chartmetric.raw_data.cm_artist a on a.id = s.target_id
#where s.target = 'cm_artist'
#and to_date(timestp) >= (current_date - 4)
#group by 2,1),
#
#past_socials as (
#
#select a.name as name2, s.account_id as account_id2, nullifzero(max(ig_followers)) as past_ig_followers,nullifzero(max(fb_likes)) as past_fb_likes,
#nullifzero(max(tw_followers)) as past_tw_followers, nullifzero(max(tt_followers)) as past_tiktok_followers, nullifzero(max(yt_views)) as past_youtube_views
#from INTELLIGENCE.DBT_PROD.CM_SOCIAL_UNION s
#left join chartmetric.raw_data.cm_artist a on a.id = s.target_id
#where s.target = 'cm_artist'
#and to_date(timestp) <= (current_date - 8) and to_date(timestp) >= (current_date - 12)
#group by 2,1)
#
#select name as name, account_id as account_id, current_ig_followers, ((current_ig_followers - past_ig_followers)/past_ig_followers) as ig_follower_change,
#current_fb_likes, ((current_fb_likes - past_fb_likes)/past_fb_likes) as fb_likes_change,
#current_tw_followers, ((current_tw_followers - past_tw_followers)/past_tw_followers) as tw_followers_change,
#current_tiktok_followers, ((current_tiktok_followers - past_tiktok_followers)/past_tiktok_followers) as tiktok_followers_change,
#current_youtube_views, ((current_youtube_views - past_youtube_views)/past_youtube_views) as youtube_views_change
#from current_socials cs
#left join past_socials ps on cs.name = ps.name2 and cs.account_id = ps.account_id2
#group by 2,1,3,4,5,6,7,8,9,10,11,12;;
#
```

