Linq statement for Orders reporting
<p>I have orders in my database, each of which has a collection of Allowances.  An Allowance related to an Order has a ChargeIndicator to denote if it's a discount (0) or not (1).</p>

<p>For a time period, I need the discounts used during that time, and the sum of the orders that used each discount.</p>

<p>I can get the list of used discounts, but am having trouble going back to Orders to get the aggregates</p>

<pre><code>var discounts = this.Repository.GetOrders()
            .Where(o =&gt; 
                o.AllowanceCharge.Any(ac =&gt; !ac.ChargeIndicator) &amp;&amp;
                o.IssueDate &gt; DateTime.Now.AddDays(-10) &amp;&amp;
                o.IssueDate &lt; DateTime.Now.AddDays(-1))
            .SelectMany(o =&gt; o.AllowanceCharge.Where(ac =&gt; !ac.ChargeIndicator))
            .Discinct()
</code></pre>