Multidimensional aggregates
MS Analysis Services (Multidimensional)'s [almost] whole reason for being is to abstract away aggregations so you can simply query tour OLAP data without having to worry about how the aggregate value is being retrieved.  In fact, in Analysis Services Multidimensional, you point and click to create your aggregation combinations.

I'm not sure what database server you're running, but if you're running SQL Server 2014 you also have the ability to build a clustered columnstore index on your fact table.  Doing this will, in a most peoples' cases, essentially eliminate the need for you to perform aggregations entirely.  I'd definitely look into that as an option if you're on SQL Server and your data and resources are a good fit.

In that similar vein, if you're not running SQL Server, there are a lot of columnar databases out there which service OLAP workloads quite well, such as Tableau ($$$).  I'm not sure what the open-source space has to offer, but that's worth checking out as well.