Stefano Raimondi
2023-12-07 17:52:20 UTC
Buon giorno, sto cercando di gestire i valori in una query a campi incrociati in base al valore intestazione colonne, o meglio vorrei caricare il corretto numero di valore nella cella valore in base al numero di settimana nell'intestazione, ovvero fino alla settimana attuale le ore spese dalla prossima le ore stimate.
Per farvi capire questa è la query:
TRANSFORM IIf([Wk]>DatePart("ww",Now()),Sum([Ore stimate Wk]![StimaWk]),Sum([Ore spese Wk 0]![SpeseWk])) AS H
SELECT [Ore spese Wk 0].[ID attività]
FROM [Ore spese Wk 0] INNER JOIN [Ore stimate Wk] ON ([Ore spese Wk 0].ID = [Ore stimate Wk].ID) AND ([Ore spese Wk 0].[ID attività] = [Ore stimate Wk].[ID attività])
GROUP BY [Ore spese Wk 0].[ID attività]
PIVOT [Ore spese Wk 0].nWk In (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52);
Tutto funziona bene per le spese perchè per ogni settimana nWk ho un valore in ore mentre non riesco a far incasellare le stimante perchè ho forzato con "intestazione colonne" le 52 settimane e ho il valore stimato non associato a un numero di settimana perchè vorrei inserirlo dalla prossima in poi. Sto sbagliando il concetto alla base? qualche idea?
Grazie
Stefano
Per farvi capire questa è la query:
TRANSFORM IIf([Wk]>DatePart("ww",Now()),Sum([Ore stimate Wk]![StimaWk]),Sum([Ore spese Wk 0]![SpeseWk])) AS H
SELECT [Ore spese Wk 0].[ID attività]
FROM [Ore spese Wk 0] INNER JOIN [Ore stimate Wk] ON ([Ore spese Wk 0].ID = [Ore stimate Wk].ID) AND ([Ore spese Wk 0].[ID attività] = [Ore stimate Wk].[ID attività])
GROUP BY [Ore spese Wk 0].[ID attività]
PIVOT [Ore spese Wk 0].nWk In (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52);
Tutto funziona bene per le spese perchè per ogni settimana nWk ho un valore in ore mentre non riesco a far incasellare le stimante perchè ho forzato con "intestazione colonne" le 52 settimane e ho il valore stimato non associato a un numero di settimana perchè vorrei inserirlo dalla prossima in poi. Sto sbagliando il concetto alla base? qualche idea?
Grazie
Stefano