olapR (R package in SQL Server Machine Learning Services)

Applies to: yesSQL Server 2016 (13.x) and later

olapR is an R package from Microsoft used for MDX queries against a SQL Server Analysis Services OLAP cube. Functions do not support all MDX operations, but you can build queries that slice, dice, drilldown, rollup, and pivot on dimensions. The package is included in SQL Server Machine Learning Services and SQL Server 2016 R Services.

You can use this package on connections to an Analysis Services OLAP cube on all supported versions of SQL Server. Connections to a tabular model are not supported at this time.

Load package

The olapR package is not preloaded into an R session. Run the following command to load the package.


Package version

Current version is 1.0.0 in all Windows-only products and downloads providing the package.

Full reference documentation

The olapr package is distributed in multiple Microsoft products, but usage is the same whether you get the package in SQL Server or another product. Because the functions are the same, documentation for individual sqlrutils functions is published to just one location under the R reference for Microsoft Machine Learning Server. Should any product-specific behaviors exist, discrepancies will be noted in the function help page.

Availability and location

This package is provided in the following products, as well as on several virtual machine images on Azure. Package location varies accordingly.

Product Location
SQL Server Machine Learning Services (with R integration) C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\R_SERVICES\library
SQL Server 2016 R Services C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\R_SERVICES\library
Microsoft Machine Learning Server (R Server) C:\Program Files\Microsoft\R_SERVER\library
Microsoft R Client C:\Program Files\Microsoft\R Client\R_SERVER\library
Data Science Virtual Machine (on Azure) C:\Program Files\Microsoft\R Client\R_SERVER\library
SQL Server Virtual Machine (on Azure) 1 C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\R_SERVICES\library

1 R integration is optional in SQL Server. The olapR package will be installed when you add the Machine Learning or R feature during VM configuration.

See also

How to create MDX queries using olapR