Platform
Resources
Pricing
Sign in
Contact us
Observable
The end-to-end solution for building and hosting better data apps, dashboards, and reports.
Workspace
Fork
Published
Template Components
By
Kerry Rodden
Edited
Jul 25, 2021
8 stars
1
Template Components
Calendar component
Templates: Table of Instructions
Example cohort analysis in SQL
User Retention: Cohort Grid Component
Multidrag Axis
Cash Flow
Table Validator
Survey Visualization Suggestions
Survey Free Response Component
Survey Question Selector
Survey Matrix Compare
Survey Pie Chart
Survey Histogram
Survey Data
Survey Component Library
GitHub API Helpers
Draggable Cash Flow Curve
Insert cell
Insert cell
Insert cell
events
=
dc
.
query
(
`
SELECT *
FROM events
ORDER BY time
`
)
Insert cell
Table
(
events
)
Insert cell
Insert cell
cohorts
=
dc
.
query
(
`
WITH signups AS (
SELECT user_id, DATE(time) AS cohort_date
FROM events
WHERE type = 'signup'
GROUP BY 1, 2
)
SELECT cohort_date, DATE(time) AS period_date, COUNT(DISTINCT e.user_id) as users
FROM events e INNER JOIN signups s ON e.user_id = s.user_id
GROUP BY 1, 2
ORDER BY 1, 2
`
)
Insert cell
Table
(
cohorts
)
Insert cell
Insert cell
import
{
SQLiteDatabaseClient
}
from
"@mbostock/sqlite@259"
Insert cell
import
{
Table
}
from
"@observablehq/inputs"
Insert cell
function
ExampleDatabase
(
)
{
const
file
=
FileAttachment
(
"events.db"
)
;
return
Object
.
defineProperties
(
new
SQLiteDatabaseClient
(
file
.
arrayBuffer
(
)
)
,
{
name
:
{
value
:
"events"
,
enumerable
:
true
}
}
)
;
}
Insert cell
dc
=
ExampleDatabase
(
)
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
events
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
cohorts
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
ExampleDatabase
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
dc
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML