title: SSRS. Hide a Column based on Row Group Value
body: <p>My application uses SSRS to produce payslips for employees. The Payslip report consists of a tablix with 5 columns. Among the 5, is a column called "<strong>Units</strong>" and another called "<strong>Invoice value</strong>". </p>
  
  <p>The report has several Row Grouping levels, but the only important one for this question is the Payslip Number Row Grouping "RG_SlipNum". There is a page break after each "RG_SlipNum" RowGroup. </p>
  
  <p>When users want to print Payslips, they can optionally supply up to 5 parameters which filter the result set to print out. </p>
  
  <p>Employees can be paid based on the number of units delivered * a rate (Unit Based), or by a percentage of the invoice value (Invoice based) for the delivery (Oversimplified, but hopefully, you get my drift). </p>
  
  <p><strong>If the employee is Unit based I want the Units Column to Show, and the "Invoice Value" Column to be hidden. If they are Invoice based I want both columns to show.</strong> </p>
  
  <p>My dataset has a bit field indicating whether to show or hide a column based on the logic above. It will be a 1 or a 0 for every underlying row within the current rowGroup. I have tried to use the First(,) function in a Column Visibility expression on the "Invoice Value" Column. However, I get the following  error whenever I try to limit the scope of the First Function to the current Payslip Rowgroup using the RowGroup name. </p>
  
  <p><em>"The Hidden expression for the tablix 'X' has a scope parameter that is not valid for an aggregate function. The scope parameter must be set to a string constant that is equal to either the name of a containing group, the name of a containing data region, or the name of a dataset. "</em></p>
  
  <p>So, my Question(s)</p>
  
  <p><strong>Can you define a RowGroup name as the Scope argument in a First() function</strong>? </p>
  
  <p>If not, <strong>What's the best way of achieving this without completely re-working my Dataset / RDL to accomplish this.</strong> (Using SSRS2008)</p>