This is my last installment in my series on improving Analysis Services Tabular. If you want to start at the beginning, please click here. I started writing this because I wanted one place to point clients to improve the performance and scalability of Tabular Models, and there are a lot of places you need to go to find all of this information. I hope you find it helpful. Let me know if you have any questions or comments regarding this post I hope you leave some comments or perhaps ask me a question on twitter. With that here are more things that you need to do to improve your Analysis Services Tabular implementations.
Optimize your DAX Code
While it is not easy to performance tune DAX you can do it, by evaluating the DAX Query Plan and VeritPaq Queries, and SQLBI’s VertiPaq Analyzer. Also, you can also look to use functions which perform better, for example COUNTROWS instead of DISTINCTCOUNT or ADDCOLUMNS instead of SUMMARIZE. Whenever possible use the CALCULATE function instead of the FILTER function, as CALCULATE filters for context inside the parenthesis and are more efficient. Also all of the iterative functions SUMX, COUNTX etc., should be used sparingly as the row-by-row transactions they create are less efficient and should be used only when SUM or COUNT will not work. When evaluating if a value missing, if it is possible, use ISEMPTY instead of ISBLANK as ISEMPTY looks only for the presence of a row, which is faster than the evaluation performed by ISBLANK.
Sort by Settings
There are times when the sort needs to be specified as something other than alphabetic. A common place where this is done is for months, as people want to see January appearing first rather than April. April will appear by default as the dates are sorted alphabetically. To change this, modify the Month Name column property Sort by Column to sort by the Month number field so the months will always appear with January first. This process should be repeated for any column where the alphabetic sort is not likely what people want to see, such as Day of Week.
All values should be formatted in a way that will look good on reports. Most of the time this formatting has been included, but there are some instances where the general format is used instead. Most users want numbers which include a thousands separator. In analysis services tabular, this is accomplished by using a custom format and the format style #,##0. This will add the thousands separator when needed and will never show a decimal number.
All values not used in a report should be hidden. This will make things less confusing for people who are writing reports as the values that appear are ones which they actually use. For purposes of joining tables, many times you need to bring in key values to create relationships, but they are not values which should be reported upon as they have no business meaning.
Business Friendly Column and Table Names
When creating Power BI reports, the column names in the table are the names used in the reports. As a best practice, the names in the tabular model should be business friendly names. All of the column names visible in the model should be names which can be readily understood by anyone reading the report. Names should include special characters like spaces and should be appropriately capitalized in the normal function names appear. For example WK_NUM would appear as something like “Week Number” would be understandable to the user and look appropriate on reports. Using views can also provide the ability to change the names to user readable names outside of the model, which is also considered a best practice as then the model does not need to be changed to have user specified names.
Data aficionado et SQL Raconteur
Pingback: More Tabular Best Practices – Curated SQL