Doubt with pivot table in access

0

I have this query in access, but I can not sort the Format ([DateCob], "mmmm") by the order of the months, they are sorted by alphabetical order (April, August, December, etc.) and I want it by order of months (January, February, etc.) This is my query

TRANSFORM Sum(Compras.Importe) AS SumaDeImporte
SELECT Compras.PG
FROM Compras
WHERE (((Compras.BU)='EPMV'))
GROUP BY Compras.PG
PIVOT Format([FechaCobro],"mmmm");

Thanks for your help

    
asked by oscar ramirez 06.02.2017 в 03:54
source

1 answer

2

Format([FechaCobro],"mmmm") returns a string, which is why they appear arranged in alphabetical order. To order according to the sequence, you must use the number instead of the name that corresponds to each month.

  

NOTE: Be sure to limit the report to one year data or include year and month, instead of just the month.

One way to approach cases like this is to produce the desired result by parts, one to perform the calculations and obtain the structure you want, in this case a pivot table, and another to replace the numerical values of the months by name .

    
answered by 17.02.2017 / 08:00
source