Can I write an expression in a crosstab query to do a calculation for my Crosstab Value?
Please see frmEscalationReports in the attached database. Choosing values from the 2 drop down boxes and clicking on the button opens the crosstab query. Currently my Crosstab Value just gives a count.
Instead of a Count, if the Column Headers are "Maint Overrun","Maint Underrun", "Dev Overrun" or "Dev Underrun", I would like to do a math calculation to find the variance.
I tried:
Expr1:
IIf([CodeGrouping] Is Null,Count([tblEscalationReportsDetail]![Criteria Code]),
IIf([CodeGrouping] In ("Maint Overrun","Maint Underrun"),(([YTDCostActualMaint]-[YTDCostPlannedMaint])/[YTDCostPlannedMaint]),
IIf([CodeGrouping] In ("Dev Overrun","Dev Underrun"),(([YTDCostActualDev]-[YTDCostPlannedDev])/[YTDCostPlannedDev]))))
What I'm saying is, go to tblEscalationReportsDetail and look at the column called CodeGrouping. If that is null, then use the Count of Criteria Code in that same table for the value.
If CodeGrouping equals "Maint Overrun" or "Maint Underrun", then do a calculation using YTDCostActualMaint and YTDCostPlannedMaint from the Project Status Survey Budget table.
If CodeGrouping equals "Dev Overrun" or "Dev Underrun", then do a calculation using YTDCostActualDev and YTDCostPlannedDev from the Project Status Survey Budget table.
But I am getting a message 'You tried to execute a query that does not include the specified expression 'IIf([CodeGrouping] Is Null,.....' as part of an aggregate function'
Is my logic correct or can't this be done?
Please see frmEscalationReports in the attached database. Choosing values from the 2 drop down boxes and clicking on the button opens the crosstab query. Currently my Crosstab Value just gives a count.
Instead of a Count, if the Column Headers are "Maint Overrun","Maint Underrun", "Dev Overrun" or "Dev Underrun", I would like to do a math calculation to find the variance.
I tried:
Expr1:
IIf([CodeGrouping] Is Null,Count([tblEscalationReportsDetail]![Criteria Code]),
IIf([CodeGrouping] In ("Maint Overrun","Maint Underrun"),(([YTDCostActualMaint]-[YTDCostPlannedMaint])/[YTDCostPlannedMaint]),
IIf([CodeGrouping] In ("Dev Overrun","Dev Underrun"),(([YTDCostActualDev]-[YTDCostPlannedDev])/[YTDCostPlannedDev]))))
What I'm saying is, go to tblEscalationReportsDetail and look at the column called CodeGrouping. If that is null, then use the Count of Criteria Code in that same table for the value.
If CodeGrouping equals "Maint Overrun" or "Maint Underrun", then do a calculation using YTDCostActualMaint and YTDCostPlannedMaint from the Project Status Survey Budget table.
If CodeGrouping equals "Dev Overrun" or "Dev Underrun", then do a calculation using YTDCostActualDev and YTDCostPlannedDev from the Project Status Survey Budget table.
But I am getting a message 'You tried to execute a query that does not include the specified expression 'IIf([CodeGrouping] Is Null,.....' as part of an aggregate function'
Is my logic correct or can't this be done?
Attachments
Last edited: