Why the variable always zero
<p>I found a very strange thing:</p>

<pre><code>var PerformanceSingleList = TradePositionList//Compute the data for each stock everyday
            .SelectMany((o, idx) =&gt; o.Select(p =&gt;
            {
                //default variable
                double CloseYesterday = TradePositionList.ElementAt(0).Where(q =&gt; q.Stock.Symbol == p.Stock.Symbol).Select(q =&gt; (double)q.Stock.Close).First();
                int PositionYesterday = TradePositionList.ElementAt(0).Where(q =&gt; q.Stock.Symbol == p.Stock.Symbol).Select(q =&gt; q.Position).First();
                int TradePositionToday = 0;
                if (idx != 0) //idx cann't be 0 otherwise, idx - 1 throw a error
                {
                    PositionYesterday = TradePositionList.ElementAt(idx - 1).Where(q =&gt; q.Stock.Symbol == p.Stock.Symbol).Select(q =&gt; q.Position).First(); 
                    CloseYesterday = TradePositionList.ElementAt(idx - 1).Where(q =&gt; q.Stock.Symbol == p.Stock.Symbol).Select(q =&gt; (double)q.Stock.Close).First();
                    TradePositionToday = TradePositionList.ElementAt(idx - 1).Where(q =&gt; q.Stock.Symbol == p.Stock.Symbol).Select(q =&gt; q.RealDesignTradeShare).First();                        
                }

                double Commission = Math.Abs(TradePositionToday) * (double)p.Stock.Close * C;


                return new
                {
                    p.Stock,
                    p.Position,
                    p.RealDesignPosition,
                    p.RealDesignTradeShare,
                    TradePositionToday,
                    Commission,
                    PLN = ((double)p.Stock.Close - CloseYesterday) * PositionYesterday + TradePositionToday * (double)p.Stock.Close - Math.Abs(TradePositionToday) * (double)p.Stock.Close * SA,
                    NAV = (double)p.Stock.Close * p.Position - Math.Abs(p.Position) * (double)p.Stock.Close * SA - Commission
                };
            }
               ).ToList()
            ).ToList();
</code></pre>

<p>But,  all the Commision in <code>PerformanceSingleList</code> are zero even <code>TradePositionToday</code>  is not zero. Furthermore, there is no such problem when I use my little sample data, only occurred when I use real big data.</p>

<pre><code> [61]   { Stock = {{ Symbol = 1088 HK, Close = 12.860000000, Date = 3/7/2016 12:00:00 AM, Vol = 0.0490939300240106 }}, Position = -562, RealDesignPosition = 67, RealDesignTradeShare = 629, TradePositionToday = -562, Commission = 0, PLN = -7227.32, NAV = -7227.32 }    &lt;Anonymous Type&gt;
    Commission  0   double
    NAV -7227.32    double
    PLN -7227.32    double
    Position    -562    int
    RealDesignPosition  67  int
    RealDesignTradeShare    629 int
    Stock   { Symbol = "1088 HK", Close = 12.860000000, Date = {3/7/2016 12:00:00 AM}, Vol = 0.049093930024010565 } &lt;Anonymous Type&gt;
    TradePositionToday  -562    int
</code></pre>