XLCubed has supported a drag/drop interface for creating reports against Tabular Analysis Services since the first release of the new engine. It lets users easily create reports which run DAX queries on the cube, and we’ve often seen very good performance at customers when MDX against Tabular was a cause of long running reports.
So when we were approached at SQL Pass in Seattle by some attendees who had a SSAS Tabular performance issue we were optimistic we’d be able to help.
In this case the business wanted to retrieve thousands of rows from the cube at the transactional level, and the first approach had been to use PivotTables in Excel. To get to the lowest level they cross-joined the lowest levels of all the hierarchies on the rows section which would give the right result, but performance was terrible, with several queries taking 20 minutes or more and others not returning at all.
We hoped using an XLCubed table running DAX would be the solution and created the same report in the designer. Sadly while performance was a little better it was still far from acceptable; the model was large, and the number or columns combined with their cardinality meant that a lot of work was being done on the server.
XLCubed’s DAX generator was trying to cross-join all the values from each column, which had worked well for our other customers. But when there are a dozen columns including the transaction ID things do not go so well. DAX in itself is not a magic bullet and SSAS Tabular models can hit performance problems on low level data – we needed a new approach.
After some investigation we discussed the issue and our thinking with our friends at SQLBI and determined that instead of cross-join we wanted an option to use Summarize() instead as this only uses the rows in the database, and it can access columns related to the summarized table which were required for the report.
As the customer’s report had the transaction ID in it the result wasn’t aggregated, even though we were using summarize. But we wanted to add true transactional reporting too, using the Related() function.
Finally, SQL 2016 adds a couple of new functions, SummarizeColumns() and SelectColumns(), both of which are useful for this type of reporting, but offer better performance than the older equivalents.
The end result in XLCubed is a new option for DAX tables to allow users to set the type of report they want to run, and some internal changes so that XLCubed will automatically use the most efficient DAX function where they are available.
A beta was sent to the business users and the results were fantastic. The report which had run for several minutes now completed in a few seconds, and 20 minutes was down to 15 seconds – we had some very happy users!
The changes will be in the next release of XLCubed so that all our customers can benefit from the improvements. It’s always nice when a customer request helps improve the product for everyone.
A sample of the syntax change is included below
Before:
EVALUATE FILTER ( ADDCOLUMNS ( KEEPFILTERS ( CROSSJOIN ( VALUES ( 'Customer'[Education] ), VALUES ( 'Product'[Color] ) ) ), "Internet Total Units", 'Internet Sales'[Internet Total Units], "Internet Total Sales", 'Internet Sales'[Internet Total Sales] ), NOT ISBLANK ( [Internet Total Units] ) ) ORDER BY 'Customer'[Education], 'Product'[Color]
After:
EVALUATE FILTER ( ADDCOLUMNS ( KEEPFILTERS ( SUMMARIZE ( 'Internet Sales', 'Customer'[Education], 'Product'[Color] ) ), "Internet Total Units", 'Internet Sales'[Internet Total Units], "Internet Total Sales", 'Internet Sales'[Internet Total Sales] ), NOT ISBLANK ( [Internet Total Units] ) || NOT ISBLANK ( [Internet Total Sales] ) ) ORDER BY 'Customer'[Education], 'Product'[Color]