Filtering units by a dynamic Lambda expression
Don't omit braces. Ever. It's such a bad idea (I learned this the hard way).

As far as your lambda, your method is not necessarily a bad thing, though there are always other ways to write it.

var unitGroups = _db.Units
                    .Where(u =&gt; (onlyChildren &amp;&amp; u.PhaseId == id) || (!onlyChildren &amp;&amp; u.PhaseId != id))
                    .GroupBy(m =&gt; .UnitTemplate, (m, group) =&gt; new UnitTemplateZoneVm()
                    {
                        Id = m.Id,
                        Units = group.ToList()
                    })
                    .ToList();


Whitespace is free, use it. It makes it clearer as to what steps belong together.

I would personally prefer this method, as you can extract this out into LINQ-SQL style, instead of using the methods. Personally, I prefer the LINQ-SQL style rather than the methods, but the choice is up to you.