Share via


Grain (OLAP)

Overview

In SQL Server Analysis Services (SSAS), the grain or granularity of a [[articles:Fact (OLAP)|fact]] defines the level of detail recorded in the fact; it is determined by the [[articles:Dimension|dimension]] keys of the fact. If a fact references the key attribute of a dimension, then it records data at the most descriptive level of detail possible for that dimension; if it references other attributes of the dimension, then the fact may be stored at a less descriptive, aggregate level of detail. For example, if a time dimension has Date as its key attribute then facts that reference the Date attribute store their data at the granularity of a single date. If the dimension also contains a Month attribute, and facts reference the Month instead, then the granularity of the fact is month, and the measures of the fact will contain values that are aggregated by month.

Granularity also applies to queries in Analysis Services. The grain of a query describes the level of detail requested by the query. The grain of a query can be different from the grain of the facts in the Analysis Services database. For example, a database might store facts at the level of Date, but a query can request data at the level of Month instead. Analysis Services will aggregate lower level facts to produce a record at the higher level requested by the query.


Other Languages

This article is also available in the following languages:

Brazilian Portuguese (pt-BR)