Wednesday, August 12, 2026

194 ) Grain and granularity


Grain and granularity 


  • Grain is stated using minimum column names combination   that uniquely define a single row , not a numeric count of columns.

  • Granularity 

  •  Granularity in data refers to the level of detail 
  • is expressed in levels of detail or hierarchy (e.g., transactional level, daily level, monthly level, or region level) describing how coarse or fine the data is.

  

The client wants to know how many policies are sold per month in a region."

Step 1: Break down the request

  • Metric: Number of policies sold (Count of Policy ID).
  • Dimensions: Time (Month) and Geography (Region).

Step 2: Determine the atomic level (The Grain)

 

Grain = One row per policy sale 

(  Policy_ID, Sale_Date, Agent_ID, Customer_ID, Branch_ID, Region_ID).

Granularity

It is at the transaction level (specifically, one row per individual policy sale).

It would be at the store level (or branch level) if the data was aggregated to track total sales metrics per branch per day (e.g., Branch_ID, Sale_Date, and Total_Sales_Amount), 

No comments:

Post a Comment

212 What is Medallion Architecture?

 212 What is Medallion Architecture? Medallion Architecture is a data design pattern used to logically organize data in a data lake or lakeh...