From the course: SQL Server Analysis Services
Unlock the full course today
Join today to access over 24,600 courses taught by industry experts.
Using the CALCULATE function - SQL Server Tutorial
From the course: SQL Server Analysis Services
Using the CALCULATE function
- [Instructor] So the calculate function is arguably the most powerful function in the DAX language. It combines an aggregation with a filter that gives you the ability to look at only a section of the data. So when you use analysis services, people are able to filter aggregations using perhaps a Visual Power BI, or filters in Excel pivot tables. But calculate can override those filter statements, and use just what you want to specify. So the first part of any calculate statement is some kind of an aggregation that can be something like sum, count, average, min, max, all of those are aggregations. The next part of this statement is what you are filtering. You can filter using a single value such as where product color equals red, or, as we see here where territory country equals United States. You can also do something a little bit more complex by using another function, or a more complex filter statement. You can use…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.