title: How to sort on a derived column in IQueryable
body: <p>I have a column that needs to be derived from the result set that IQueryable returns. Also I want to Sort on that Column. How can I do this ??</p>
  
  <pre><code>var opportunities = this.GetUserOpportunitiesByQuery(request, statusOpp)
                  .Include(x =&gt; x.CompanyId__Parent)
                  .Include(x =&gt; x.ApprovalStatus__Parent)
                  .Include(x =&gt; x.OpportunityStatus)
                  .Include(x =&gt; x.MeetingType__Parent);
  </code></pre>
  
  <p>On Columns that are present in the result we sort on them like this:-</p>
  
  <pre><code>var sortBy = request.SortBy?.FirstOrDefault();
      if (sortBy != null)
      {
          var asc = sortBy.Direction == SortingDirection.Ascending;
          switch (sortBy.PropertyName.ToLower())
          {
              case "name":
                  opportunities = asc
                      ? opportunities.OrderBy(c =&gt; c.Name)
                      : opportunities.OrderByDescending(c =&gt; c.Name);
                  break;
  
  
  var results = opportunities.Skip(request.Skip).Take(request.Take).ToList();
  </code></pre>
  
  <p>I need to do the same as above with a derived column. I can have a function that will derive and call it. I am just not clear on how we can do this.</p>
  
  <p>I know I can do .ToList() and calculate the derived column and sort on it. But I think that would sort the query in-memory. Can I do this with IQueryable. </p>