papadega3000
Registered User.
- Local time
- Today, 00:02
- Joined
- Jun 21, 2007
- Messages
- 80
I have this query setup to produce summed values and it works fine. Now I am trying to display the output of the query in a pivotchart however it does not seem to pull all of the data in the query. My mock data table has three test cases in it. And it seems that this query will only show 2 out of the 3 test cases because the 3rd test case does not have any dates in the field so the expressions evaluate to a #Error value. What I was wondering is how I can nullify that empty value. I believe I can use the Nz() function? But I am not sure how. Here is the query I built:
Would I have to do something like this??? Or does the Nz() have to incorporate the entire expression??
Thanks in advance for any advice.
Code:
SELECT Run.Test_Case,
Sum(IIf([Attempted_Actual]<= Date(),[Points],0))/Sum(IIf(Not IsNull([Attempted_Actual]),[Points],0))*100 AS ActualAttempted,
Sum(IIf([Completed_Actual]<= Date(),[Points],0))/Sum(IIf(Not IsNull([Completed_Actual]),[Points],0))*100 AS ActualCompleted,
Sum(IIf([Verified_Actual]<=Date(),[Points],0))/Sum(IIf(Not IsNull([Verified_Actual]),[Points],0))*100 AS ActualClosed,
Sum(IIf([Attempted_Planned]<= Date(),[Points],0))/(Sum(Task.Points))*100 AS PlannedAttempted,
Sum(IIf([Completed_Planned] <=Date(),[Points],0))/(Sum(Task.Points))*100 AS PlannedCompleted,
Sum(IIf([Verified_Planned]<= Date(),[Points],0))/(Sum(Task.Points))*100 AS PlannedClosed
FROM Run INNER JOIN Task ON Run.Run=Task.Group
GROUP BY Run.Test_Case
HAVING (((Run.Test_Case)=IIf(IsNull([Forms]![Status]![ComboStatusTestCase]),[Test_Case],[Forms]![Status]![ComboStatusTestCase])));
Would I have to do something like this??? Or does the Nz() have to incorporate the entire expression??
Code:
SELECT Run.Test_Case,
Sum(Nz(IIf([Attempted_Actual]<= Date(),[Points],0))/Sum(IIf(Not IsNull([Attempted_Actual]),[Points],0)))*100 AS ActualAttempted,
Sum(Nz(IIf([Completed_Actual]<= Date(),[Points],0))/Sum(IIf(Not IsNull([Completed_Actual]),[Points],0)))*100 AS ActualCompleted,
Sum(Nz(IIf([Verified_Actual]<=Date(),[Points],0))/Sum(IIf(Not IsNull([Verified_Actual]),[Points],0)))*100 AS ActualClosed,
Sum(Nz(IIf([Attempted_Planned]<= Date(),[Points],0))/(Sum(Task.Points)))*100 AS PlannedAttempted,
Sum(Nz(IIf([Completed_Planned] <=Date(),[Points],0))/(Sum(Task.Points)))*100 AS PlannedCompleted,
Sum(Nz(IIf([Verified_Planned]<= Date(),[Points],0))/(Sum(Task.Points)))*100 AS PlannedClosed
FROM Run INNER JOIN Task ON Run.Run=Task.Group
GROUP BY Run.Test_Case
HAVING (((Run.Test_Case)=IIf(IsNull([Forms]![Status]![ComboStatusTestCase]),[Test_Case],[Forms]![Status]![ComboStatusTestCase])));
Thanks in advance for any advice.