Question

I want to create a crosstab query where the pivot is a field with natural numbers (delayed days of a document) but I want to group them (those documents delayed less than 1 week, then those delayed less than two weeks, and then the rest of documents) but I try and I only have those whose delayed days are just 1 week and no less and so on. This is my code:

TRANSFORM Count(BlueCielo.[Document Number]) AS [CuentaDeDocument Number1]
SELECT Documentos.[Disciplina Interna], BlueCielo.[Client Response Return Status], Count(BlueCielo.[Document Number]) AS [CuentaDeDocument Number]
FROM BlueCielo INNER JOIN Documentos ON BlueCielo.[Document Number] = Documentos.[Numero Documento Cliente]
WHERE (((Documentos.[Documento Interno])="N"))
GROUP BY Documentos.[Disciplina Interna], BlueCielo.[Client Response Return Status]
ORDER BY Documentos.[Disciplina Interna], BlueCielo.[Client Response Return Status]
PIVOT BlueCielo.[Delayed Days] in (0,7,14,21);

the part that I do not know how to implement is just the last paragraph:

PIVOT BlueCielo.[Delayed Days] in (0,7,14,21);

(BlueCielo is my table and [Delayed Days] is the field with the data).

When I try with

PIVOT BlueCielo.[Delayed Days] in (0,>7,>14,<14);

it gives me an error.

Can anyone help me? Thanks a lot!!

Was it helpful?

Solution

I have try with this and I have solve the problem!

PIVOT IIf([Delayed Days]<1,"0 dias",IIf([Delayed Days]<7,"<1 wek",IIf([Delayed Days]<14,"<2 weeks",IIf([Delayed Days]<21,"<3 weeks",">3 weeks"))));

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top