psaaccess
Programmer
- Apr 14, 2008
- 18
I created a report and user asked me to modify.I have data
always like this or more yes =2 or NA = 2 or both of them 0
1.Totalyesscore =2 TotalNAscore=0
2.TotalYescore=0 TotalNAscore=2
3.TotalYesscore = 0 TotalNAscore = 0
I used IIF statement on report column to add and calculate %. Always calculate 100%
=IIF([tablename.totalyesscore]=0 and [tbalename.totalofnascores]=0,0,[tablename.totalofyesscore]/([tablename.totalyesscore]+[tablename.totalNAscore])
result is 1. 100% (correct result)
2. 0% (wrong) This has to be 100%
3. 0% (correct result)
=IIF([tablename.totalyesscore]=0 and [tbalename.totalofnascores]=0,0,[tablename.totalofyesscore]+[tablename.NAScore]/([tablename.totalyesscore]+[tablename.totalNAscore])
Result is : second resutl is giving 200%
How can I write Nested IIF statement to get correct result?
I appreciate if any one let me know solution ASAP.
Thank you,
always like this or more yes =2 or NA = 2 or both of them 0
1.Totalyesscore =2 TotalNAscore=0
2.TotalYescore=0 TotalNAscore=2
3.TotalYesscore = 0 TotalNAscore = 0
I used IIF statement on report column to add and calculate %. Always calculate 100%
=IIF([tablename.totalyesscore]=0 and [tbalename.totalofnascores]=0,0,[tablename.totalofyesscore]/([tablename.totalyesscore]+[tablename.totalNAscore])
result is 1. 100% (correct result)
2. 0% (wrong) This has to be 100%
3. 0% (correct result)
=IIF([tablename.totalyesscore]=0 and [tbalename.totalofnascores]=0,0,[tablename.totalofyesscore]+[tablename.NAScore]/([tablename.totalyesscore]+[tablename.totalNAscore])
Result is : second resutl is giving 200%
How can I write Nested IIF statement to get correct result?
I appreciate if any one let me know solution ASAP.
Thank you,