How to "let" in lambda expression?

Basically, you need to use Select and an anonymous type to add the average to your object, followed by the rest of your statement.

Not tested but it should look like this:

Stores.Select(
    x => new { averagePrice = x.Sales.Average(s => s.Price), store = x})
.Where(y => y.averagePrice > 500 && y.averagePrice < 250)
.Select(x => x.store);

Warning: This works well for Linq-to-Entities, but be careful with these constructs in Linq-to-Objects. Using let creates a new anonymous type per object in your collection, it consumes a lot of memory with large collections.

Look here for details: Let in chained extension methods


So, you can use the extension method syntax, which would involve one lambda expression more than you are currently using. There is no let, you just use a multi-line lambda and declare a variable:

var results = Stores.Where(store => 
{
    var averagePrice = store.Sales.Average(s => s.Price);
    return averagePrice > 250 && averagePrice < 500;
});

Note that I changed the average price comparison, because yours would never return any results (more than 500 AND less that 250).

The alternative is

var results = Stores.Select(store => new { Store = store, AveragePrice = store.Sales.Average(s => s.Price})
    .Where(x => x.AveragePrice > 250 && x.AveragePrice < 500)
    .Select(x => x.Store);