Help
I really don't know how to achieve this. A business user ask me this: "if i filter only one year on combo box i need you to sum the metric, but if i choose more than one year i need you to average the metric." when i use =iif(parameters!year.count = 1,sum(sales),avg(sales)) it sums all the details rows. Anyone could suggest? Regards, Erick
May 7th, 2011 2:53pm

Hi , Can you give details on how does your o/p look like. Also to debug can you check the o/p of parameters!year.count = 1 by placing this expression in a seperate textbox . Also check the o/p by placing sum(sales)& avg(sales) in seperate text box and see the o/p. does it give same value. Please do give us more details Regards, PS
Free Windows Admin Tool Kit Click here and download it now
May 8th, 2011 3:05am

Hi ericklcl, From your description, you want to calculate the sales total or the sales average which is based on the number of years. Could you please post me the expected result after try to use the expression that you posted above? I designed a report on my local machine based on understanding. For example, I have three fields in my dataset which are Year, Category and OrderQuantity. Here are my steps: 1. Drag a matrix from the Toolbox window to the design surface, and then drag the Category field to the Row group, drag the OrderQuantity field to the column group. 2. In the Row Groups pane, right-click “Category” and point to “Add Group”, and then select “Parent Group”. Click the Group by drop-down list and select [Year]. 3. In the Report Data window, right-click Parameters node and select “Add Parameter”. Input “Year” in both “Name” and “Prompt” properties, and then select the “Allow multiple values” checkbox. Click OK to close the dialog. 4. Right-click the Category in the matrix and point to “Add Total”, select “After”. In the third column of the third row, set the expression like this: =IIF(Parameters!Year.Count=1, Sum(Fields!SalesAmount.Value, Avg(Fields!SalesAmount.Value) 5. Right-click the second row of the matrix and select “Tablix Properties”. In the Filter page, click “Add” and set the filter like this: Expression: [Year] Operator: In Value: [@Year] When preview the report, I can choose one year in the parameter drop-down list and the report display the OrderQuantity total of this year, or I can choose more than one year and the report display the OrderQuantity average of each year. The result as shown in the following figures: Select one year result: Choose more than one year result: If I have something misunderstood, please point out and post an example to explain your requirements. I will assist you to achieve it. Thanks, Bin Long
May 12th, 2011 4:56am

Dude, You are the MAN. Thanx so much
Free Windows Admin Tool Kit Click here and download it now
May 12th, 2011 7:15pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics