title: SSRS Group By Parameter
body: <p>If I have a report parameter (<code>@Fruit</code>) that allows multiple selections how can I use the parameter as a column group in an SSRS Matrix?</p>
  
  <p>Typically, I would use the parameter in my query like the following:</p>
  
  <pre><code>WHERE tbl.fruit In ( @Fruit )
  </code></pre>
  
  <p>Then I would use the column in the dataset as my group. However, in this case I need the full dataset returned. I can't filter the query, but I still want to only display the groups selected by the parameter. If my query returns Apples, Oranges and Bananas, but the parameter only selects Apples and Oranges my tablix should only have 2 columns.</p>
  
  <p>I've tried setting the Group By expression to <code>=Parameters!Fruit.Value</code>, but then I get this error:</p>
  
  <blockquote>
    <p>The Group expression used in grouping ‘ColumnGroup’ returned a data
    type that is not valid. (rsInvalidExpressionDataType)</p>
  </blockquote>
  
  <p>My parameter type is <strong>Text</strong> and I've tried it with and without allowing blank values.</p>