Shop1 01/02/2016 Yes Yes No Yes
Shop1 01/10/2016 Yes Yes Yes No
shop1 01/23/2016 No No No No
Shop1 02/11/2016 Yes No No Yes
Shop1 02/20/2016 Yes Yes Yes Yes
Shop1 03/04/2016 No No Yes Yes
Shop2 01/03/2016 Yes Yes Yes No
Shop2 01/14/2016 No Yes No Yes
Shop2 01/28/2016 Yes No No No
Shop2 02/20/2016 No Yes Yes Yes
Shop2 02/25/2016 Yes Yes No No
Shop2 03/05/2016 Yes No No No
Select Shop, Format(DateSold,"mmm/yyyy") As YMSold, Sum(IIf(All_Yellow_Cap_Sold = "Yes", 1, 0)) as SumYellow, Sum(IIf(All_Black_Cap_Sold = "yes", 1, 0)) As SumBlack, Sum(IIf(All_White_Cap_Sold = "yes", 1, 0)), Sum(IIf( All_Red_Cap_Sold = "yes", 1, 0)) As SumRed
From YourTable
Group By Shop, Format(DateSold,"mmm/yyyy") ;
Taras
ASKER
Pat I need just mmm/yyyy grouping not Shops any more, I adjusted your solution it gives me column totals as first row but not proper numbers for mmm/yyyy rows just 1 or 0 in those rows. Should I use count instead sum??
Taras
ASKER
I your suggestion I changed Sum(IIf(All_Yellow_Cap_Sold = "Yes", 1, 0)) with
Sum(IIf(All_Yellow_Cap_Sold = -1, 1, 0)) as I was getting error.
From YourTable
Group By Shop, Format(DateSold,"mmm/yyyy"