SSRS and Dax 28. June 2018 davidstelfox DAX, SSRS (0) Tools like Power BI have changed reporting allowing power users to leverage tabular cubes to present information quicker and without the (perceived) need for developers. However, experience tells us many users still want data in tables with a myriad of formatting and display rules. Power BI is not quite there yet in terms of providing all this functionality in the same way that SSRS is. For me, SSRS's great value and, at the same time its curse, is the sheer amount of customisation a developer can do. I have found that almost anything a business user demands in terms of formatting and display is possible. But you have invested your time and money in a tabular SSAS model which plays nicely with Power BI but your users want SSRS reports so how to get to your data - using DAX, of course. Using EVALUATE, SUMMARIZECOLUMNS and SELECTCOLUMNS you can return data from a tabular model in a tabular format ready to be read as a dataset in SSRS. If you had the following data in your tabular model: ProductName ProductCategory Country Sales Surly Steamroller Complete bike France £46,575 Genesis Day One Frame France £47,987 Genesis Day One Frame France £47,987 Genesis Vapour 20 Complete bike France £24,867 Genesis Vapour 20 Complete bike United Kingdom £21,856 Genesis Day One Complete bike United Kingdom £47,875 Surly Steamroller Complete bike United Kingdom £27,969 Surly Steamroller Complete bike United States £46,575 Genesis Day One Frame United States £47,987 Genesis Day One Complete bike United States £47,987A pattern for returning data for SSRS could be:DEFINE VAR FilterCountry = @country EVALUATE SELECTCOLUMNS ( SUMMARIZECOLUMNS ( 'Product'[ProductName], 'ProductCategory'[ProductCategory], 'Geography'[Country], FILTER ( VALUES ( 'Geography'[Country] ), ( OR ( ( FilterCountry = "All" ), PATHCONTAINS ( FilterCountry, 'Geography'[Country] ) ) ) ), "Sales", [Sales] ), "Product Name", [ProductName], "Product Category", [ProductCategory], "Sales", [Sales], "Estimated VAT", [Sales] * 0.2 ) To step through this…The DEFINE part declare a variable which will take a value from a SSRS parameterSUMMARIZECOLUMNS will return a CROSS JOIN of all the dimension columns entered, by passing in a measure or fact column as the last part of the block (here [Sales]) it will return only the cmbinations of dimension where there is a value for measure or fact item - particularly useful if you are dealing with date table stretching into the future.FILTER will filter the SUMMARIZECOLUMNS based on the SSRS parameter value. By adding the OR and PATHCONTAINS sections you can handle multi-value parameters in SSRS. This is a good blog post explaining this approach.SELECTCOLUMNS allows you to both provide friendly names for any dimensions (this is better handled in the tabular model but the amount of times it isn't) and also perform calculations within your DAX query. If your SSRS parameter was set to France and United Kingdom, the results would be: Product Name Product Category Country Sales Estimated VAT Surly Steamroller Complete bike France £46,575 £931.50 Genesis Day One Frame France £47,987 £959.74 Genesis Day One Frame France £47,987 £959.74 Genesis Vapour 20 Complete bike France £24,867 £497.34 Genesis Vapour 20 Complete bike United Kingdom £21,856 £437.12 Genesis Day One Complete bike United Kingdom £47,875 £957.50 Surly Steamroller Complete bike United Kingdom £27,969 £559.38If you set up a connection to your tabular cube in SSRS, you can paste in your DAX code, configure your parameters and you are good to go!