Report variables are used for calculations or subtotals storing during the report execution. Values stored into report variables should be calculated from the main report table or tables in relation with this main report table. (Main report table is the one which is used for data output in report detail band.)
You cannot set additional conditions when calculating report variables because the record scope used for calculation is given by the record scope used in REPORT FORM command. Of course, you can use IIF() when calculating report variables.
I don't understand what is grayed out. If you define the variable name first then you may define expression for initial value, expression for value to store in each reported record etc. You may call UDF from this expressions and in this UDF you may calculate whatever you need.
If you need to calculate something "outside" the reported table then you should calculate it before the report run and store it to the standard VFP variable. Such variable can be printed out as any other data.
If you need to store some average to variable X as described in your question:
x=Average(tablename.cost) for year(date)=2009 .and. Month(date)>=3 .and. month(date)<=6
then you should do it prior the report run:
SELECT tablename
PRIVATE x
AVEARGE cost TO x FOR year(date)=2009 .and. Month(date)>=3 .and. month(date)<=6
*-- and now the X variable is available for the successive report.
SELECT MainReportTable
REPORT FORM .... FOR ...
etc.
If you could post the report sample or its printscreen and better explain what to calculate and where then we may help better.