ABC Inc. <100 < 50 M USD 9 AVG of SCORE for all records in AVG of Score for all records in the DB where employees <100 the DB where revenue < 50 M USD -> SQL statement -> SQL statement
In the DataPage I have fields with SQL statements defined as Calculated Value to capture the results:
Context_AVG_Employees: IsNull((SELECT AVG(Score) FROM Assessment WHERE Company_Size_Employees = [@field:Company_Size_Employees]),0) -> Result is 12 = CORRECT
Context_AVG_Revenues: IsNull((SELECT AVG(Score) FROM Assessment WHERE Company_Revenues = [@field:Company_Revenues]),0) -> Result is 12 = NOT CORRECT, should be 6
It seems that the second field takes also the value of the first calculation.
What could be the problem and what is the solution ?
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
Johan
I have encountered the following issue when using SQL statements in a Calculated Value in a DataPage:
I want to calculate average scores in a database based on the values in specific fields in the same record. These fields function as filters.
Example of record:
Company_Name Company_Size_Employees Company_Revenues Score Context_AVG_Employees Context_AVG_Revenues
ABC Inc. <100 < 50 M USD 9 AVG of SCORE for all records in AVG of Score for all records in the DB where employees <100 the DB where revenue < 50 M USD -> SQL statement -> SQL statement
In the DataPage I have fields with SQL statements defined as Calculated Value to capture the results:
Context_AVG_Employees: IsNull((SELECT AVG(Score) FROM Assessment WHERE Company_Size_Employees = [@field:Company_Size_Employees]),0) -> Result is 12 = CORRECT
Context_AVG_Revenues: IsNull((SELECT AVG(Score) FROM Assessment WHERE Company_Revenues = [@field:Company_Revenues]),0) -> Result is 12 = NOT CORRECT, should be 6
It seems that the second field takes also the value of the first calculation.
What could be the problem and what is the solution ?
Thanks !
Link to comment
Share on other sites
6 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.