# View: dt_podcasting_cumulative_downloads

**View Name:** dt_podcasting_cumulative_downloads
**Table Source:** `INTELLIGENCE.DBT_PROD.DT_PODCASTING_CUMULATIVE_DOWNLOADS`
**File Path:** `dt_podcasting_cumulative_downloads.view.lkml`

## Overview

- **File Size:** 1389 bytes
- **Lines of Code:** 53
- **Dimensions:** 4
- **Measures:** 2
- **Dimension Groups:** 0
- **Filters:** 0

## Comments & Notes

- derived_table: {
- sql: Select episode_id, report_date, to_date(episode_published_date) as episode_published_date,
- IFF(SIGN(DATEDIFF('day', episode_published_date, report_date)) = -1,

## Dimensions

| Name | Type |
|------|------|
| `episode_id` | number |
| `report_date` | date |
| `episode_published_date` | date |
| `days_since_release` | number |

## Measures

| Name | Type |
|------|------|
| `downloads` | number |
| `cumulative_downloads` | max |

## Derived Table

```sql
#     sql: Select episode_id, report_date, to_date(episode_published_date) as episode_published_date,
# IFF(SIGN(DATEDIFF('day', episode_published_date, report_date)) = -1,
#       1, (DATEDIFF('day', episode_published_date, report_date) + 1)) as days_since_release,
# count(distinct(metric_id)) as downloads,
# sum(downloads) OVER (PARTITION BY episode_id order by report_date) as cumulative_downloads
# from facts.prod.staging_raw_megaphone
# where seconds_downloaded > 60
# group by 1,2,3,4
# order by 1,2 asc;;
#
```

