in

Unlocking Information Modeling Success: 3 Should-Have Contextual Tables | by Matthew Gazzano | Jul, 2023


And ingest invaluable knowledge at no cost

Photo by Tobias Fischer on Unsplash

Information modeling is usually a difficult activity for analytics groups. With distinctive enterprise entities in each group, discovering the suitable construction and granularity for every desk turns into open-ended. However worry not! Among the knowledge you want is simplistic, free, and occupies minimal storage.

When your knowledge is modeled in full, you’ll be able to see the next advantages:

  • Queries are much less complicated to generate, and due to this fact extra readable.
  • Stories are extra scalable, lowering hard-coded values.
  • You might be probably spending much less time discovering the place the suitable knowledge lives.

Under are 3 generic tables that may streamline your crew’s analytics, which you’ll ingest into your Information Warehouse within the context of a dimensional mannequin.

For Timeseries Reporting

In case you have ever wanted to point out a enterprise metric because it was at a given time limit, it is a practically important desk to have. For instance, you might be requested:

  • “What did gross sales appear like in FY23?”
  • Are you able to present me consumer churn every day?

Administration steadily seeks insights from a timeseries perspective, asking questions like “How is x rising or shrinking over time?”. A date dimension allows versatile evaluation of assorted metrics primarily based on completely different date attributes.

Most Date Dimension tables could be created solely utilizing DDL statements immediately in your Information Warehouse, with a mixture of date capabilities.

Within the under instance, I exploit BigQuery SQL to just do that:

CREATE OR REPLACE TABLE `your_project.your_dataset.date_dimension` AS

SELECT
full_date
, EXTRACT(MONTH FROM full_date) AS calendar_month_number
, EXTRACT(YEAR FROM full_date) AS calendar_year
, EXTRACT(QUARTER FROM full_date) AS calendar_quarter
, FORMAT_DATE('%B', full_date) AS calendar_month_name
, EXTRACT(DAYOFWEEK FROM full_date) AS week_name
, FORMAT_DATE('%A', full_date) AS day_name
, CASE
WHEN EXTRACT(DAYOFWEEK FROM full_date) BETWEEN 2 AND 6
THEN TRUE
ELSE FALSE
END AS day_is_weekday
, CASE
WHEN EXTRACT(DAYOFWEEK FROM full_date) = 1 THEN DATE_SUB(full_date, INTERVAL 2 DAY) -- Sunday
WHEN EXTRACT(DAYOFWEEK FROM full_date) = 2 THEN DATE_SUB(full_date, INTERVAL 3 DAY) -- Monday
ELSE DATE_SUB(full_date, INTERVAL 1 DAY)
END AS last_weekday
, EXTRACT(MONTH FROM DATE_ADD(full_date, INTERVAL 6 MONTH)) AS fiscal_month
, EXTRACT(YEAR FROM DATE_ADD(full_date, INTERVAL 6 MONTH)) AS fiscal_year
, EXTRACT(QUARTER FROM DATE_ADD(full_date, INTERVAL 6 MONTH)) AS fiscal_quarter
FROM UNNEST(GENERATE_DATE_ARRAY('2020-01-01', '2050-12-31', INTERVAL 1 DAY)) AS full_date


Analyzing Flights within the U.S. with AWS and Energy BI | by Aashish Nair | Jul, 2023

Elevate Your Writing Recreation with AIWritingPal: The Final AI Writing Assistant