Tags
Advanced DAX interview questions, Advanced DAX Queries, Advanced DAX tutorial, Advanced DAX tutorial pdf, All in DAX, Analysis Services, Context in DAX, Data Analysis Expressions, DAX, DAX and PAwan, DAX Common Interview Questions, DAX Common Interview Questions and answers, DAX FAQ, DAX FAQs, DAX Formatter, DAX Formatter by Vikas & Pawan, DAX Interview Q & A, DAX Interview questions, DAX Microsoft, DAX Parameter Replacer, DAX Patters, DAX pawan, DAX pawan Khowal, DAX Pawan khwal, DAX Pawan Kumar, DAX Pawan Kumar Khowal, DAX pawankkmr, DAX Programming, DAX Queries asked in interviews, DAX questions, DAX Server, DAX Server - General Interview Questions and Answers, DAX Server developer Interview questions and answers, DAX Server developer Interview questions with answers, DAX SERVER Interview questions, DAX SERVER Interview questions & Answers, DAX SERVER Interview questions and Answers, DAX Server Interview Questions and Answers - Free PDF, DAX SERVER Interview questions and answers for experienced, DAX server interview questions and answers for net developers, DAX SERVER Interview questions for experienced, DAX SERVER Interview questions pdf, DAX SERVER Tips, DAX SERVER Tricky questions, DAX SSAS, DAX Tabular, DAX Tips & Tricks, DAX Tips and Tricks, DAX Tools, DAX Tricks, DAX Tricky Question, DAX Tutorial, DAX Utility, DAXX, Difficult DAX Interview Questions, Download DAX Interview Questions, Download DAX Questions, Download DAX Server Interview Question in PDF, Download DAX SERVER Interview questions, download DAX server interview questions and answers, download DAX server interview questions and answers pdf, download DAX server interview questions by Pawan Khowal, download DAX server interview questions by Pawan Kumar, download DAX server interview questions by Pawan Kumar Khowal, Dynamic Analysis Expressions, FORMAT DAX, FORMAT DAX AND MDX, Format DAXMDX, Format MDX AND DAX, Format MDXDAX, Free Download DAX SERVER Interview questions, Interview Qs.SQL SERVER Questions, Interview Questions on SQL, InterviewQuestions, InterviewQuestions for SQL, Queries for SQL Interview, SELECT All in SSRS Parameters using DAX, SELECT All in SSRS Parameters using DAX language, Tabular Model, Tool for DAX, Tools for DAX and Tabular Developers, TOP 100 DAX SERVER INTERVIEW QUESTIONS, Top 50 DAX Server Questions & Answers, Tough DAX Interview Questions, Tough DAX Queries, Tough DAX Queries Interview Questions, Tough DAX Questions, Tough PL DAX Interview Questions, Tricky DAX Interview Questions, Tricky DAX Interview Questions and answers, Tricky DAX Queries for Interview, Tricky DAX SERVER Interview Questions and answers, What is context in DAX, What is DAX?
SELECT All in SSRS Parameters using DAX language
Today let’s talk about how to add Select All in parameters using DAX language. Recently we have a requirement where we need to add a “Select All” value apart from other values we were getting from cube using DAX language. This kind of ask is very common in SSRS reports. In SQL Server we can achieve this task very easily using Union All operator but in DAX it is quite difficult. So in our case a simple scalable solution came from Isha Mattoo. Before we jump on the solution directly let’s check out the example below-
Now before doing union all operation lets first write a DAX query to get for account number. Check out the query below-
-- Evaluate ( CalculateTable ( Summarize ( InternetSales, Accounts[AccountNumber] ), Dates[Month] >= DateValue ( "2013-07-01 00:00:00" ), Dates[Month] <= DateValue ( "2015-06-01 00:00:00" ) ) ) ORDER BY [AccountNumber] DESC -- |
In the above query we are fetching accounts for a particular period. Summarize will give us distinct account numbers and Calculate table is used to filter out values as where clause in SQL Server. Calculate table returns a data table.
Now lets add a Select All in the above query
-- Evaluate ( Summarize ( ( AddColumns ( ( CalculateTable ( Summarize ( InternetSales, ROLLUP ( Accounts[AccountNumber] ) ), Dates[Month] >= DateValue ( "2013-07-01 00:00:00" ), Dates[Month] <= DateValue ( "2015-06-01 00:00:00" ) ) ), "AccNumber", If (ISBlank ( [AccountNumber] ), "Select All", [AccountNumber] ) ) ), [AccNumber] ) ) ORDER BY [AccNumber] DESC -- |
Now lets check out the output
So the inner part of the query is very easy we are finding distinct account number with date filters using calculate table. In the outer part we have added all in the account numbers column and then we have a rollup in the inner section which will club the things together. After that we were just picking the alias [AccNumber]. DAX is bit difficult to understand but once you work with closely, you can easily win it.
I hope you have enjoyed the article. Thanks for reading !
-Pawan Khowal
MSBISkills.com
You must be logged in to post a comment.