# mes.spGetOEEDataByIntervalGroupByItem

## Description
Returns OEE performance indicators grouped by item over hourly, daily, or weekly intervals. Useful for analyzing item-specific efficiencies regardless of shift structure. Data includes duration, runtime, downtime, and count-based calculations for each item.

## Syntax
<b>mes.spGetOEEDataByIntervalGroupByItem @assetId, @startDate, @endDate, @interval</b><br /><br />

<b>Parameters:</b><br />
@assetId (int): The asset to analyze.<br />
@startDate, @endDate (datetime): Date/time boundaries for analysis.<br />
@interval (varchar): One of 'Hour', 'Day', or 'Week'.<br /><br />

<b>Returns:</b><br />
List of time-bucketed rows per item containing:<br />
- Item ID, name, package count, and units<br />
- Runtime and downtime metrics<br />
- Raw and normalized counts<br />
- Target and actual performance values<br />
- Final OEE calculation

### Code Example

```sql
EXEC mes.spGetOEEDataByIntervalGroupByItem
    @assetId = 2048,
    @startDate = '2025-07-01',
    @endDate = '2025-07-10',
    @interval = 'Hour';
