what do you mean with grade> 0 ? As grade contains text the correct sysntax would be "LEN(grade) > 0", but I think this is not what you want. As far as I understad your problem, the expression should be without that:
Don't hesitate to send an exam application, if this doesn't fit.
Dear Roland (and eveyone),
The grade dimension contains a mix of numbers and strngs. Most of the grades are numeric, e.g. 4.0 means an A, 3.0, means a B, etc. In the example data I only showed one P and one F because that was enough to illustrate the problem. A student does not get credit if their numeric grade is 0. I really do want the expressIon that means: sum(if(grade='P' or grade>0,credits,0))
Thanks. Adding the sum() function did work. But I have 2 follow up questions.
1. Why is sum needed here? The manual says that the comparison operators <, > etc. will try to interpret each operand numerically.
2. Performance. Most grades will be numbers. A few will be P, F, or I (meaning pass, fail, or incomplete). Adding sum() around grade will slow down the evaluation at least a little. I think the following two expressions wil be equivalent. is there any way easy to determine which will be faster? (Here "easy" means by an analysis rather than by running a performance test, whose results would depend on the specifics of the system and the test data.)
a. sum(if(grade='P' or num(grade)>0,credits,0))
b. sum(if(grade='I' or grade='F' or grade=0,0,credits))
1. You need as you say correctly the num() to do an explicit "typecast" to compare the numeric values. BTW: I think you mean num() when you write sum(), right ?
2. I think both expression would do their job as expected. In a) you do an explicit num compare (which you need when using < or < ). In b) it is done implicit .
3. Concerning the performance, I think it is a minority topic you are looking at. This calc is done in RAM and its done only (and only the first time) when the correspondending chart(s) are shown. There are a lot of interessting perfomance threads in the forum. Using SET analysis versus using if-Statements. Or (what I like) precalculation of some values during load versus wasting enduser time for expression calculation. Or the calc of variables, which is done more often.
Hope I could give you some new aspects as you are an experienced developer to find out very usefull things.