@AccessControl.authorizationCheck: #NOT_REQUIRED @EndUserText.label: 'Sales items by region and size class' define view entity {{P}}I_SALES_CLASS as select from {{p}}sale { key region as region, count( * ) as item_count, sum( case when amount < 101 then 1 else 0 end ) as small_count, sum( case when amount >= 100 and amount < 1000 then 1 else 0 end ) as medium_count, sum( case when amount >= 1000 then 1 else 0 end ) as large_count, sum( amount ) as total_amount } where status <> 'X' group by region