Grain violations
The grain of a cube says what one row means: one time bucket plus the identity dimensions that make the row unique. A Charge job checks every row against the grain. If rows do not match, the Charge job fails instead of writing wrong numbers. To define a grain, see Source fields and grain.
What you see
| What you see | What it means |
|---|---|
| The Charge job fails with "Grain validation failed", and the run status is Error | Rows do not match the grain. The cause is usually earlier, in the Transform job. |
| The cube shows Failing with the reason "Producer failed" | The latest run of its producer failed. |
| A view shows duplicate rows or totals that are too high | Duplicate facts entered the data before the Charge job. |
A failed run does not block you from publishing a draft cube.
While a cube is a draft, a change of the grain can clear the data that the cube already holds. This is expected.
The five kinds
The failure details of the run name one of five kinds:
| Violation | What it means | Typical fix |
|---|---|---|
| Duplicate grain | Two or more rows have the same time bucket and identity values. | Aggregate or deduplicate in the Transform job. |
| Null grain value | An identity dimension is empty or missing in a row. | Give every row a value. For shared-service rows without a customer, add allocation logic or an explicit shared-service value. |
| Time mismatch | The time of a row does not align with the calendar bucket of the cube (hour to year, including the start of the week). | Aggregate to the interval of the cube, for example daily rows to the billing month. |
| Grain overlap | Time periods of the same identity overlap. | Remove the overlap. |
| Broken contract | The rows do not fit the cube in another way. For example, the Charge job does not map every field of the grain with a compatible type. | Correct the mapping in the Charge job. |
Repair a violation
- Open the failed run and select the Charge job. The error names the kind and shows sample rows.
- Repair the cause in the right job: the SQL of the Transform job for duplicates, empty values, and wrong time buckets, or the mapping of the Charge job. See Transformers and Chargers.
- Check the result with Preview.
- Publish the workflow and start a new run.
- After a successful run, the cube returns to Healthy. See Cube health.
Use a stable ID as an identity dimension and keep the label as a descriptive field, because labels change.
If the grain itself is wrong, you need a replacement cube: the grain of a published cube is locked. See When the locked grain is wrong.