Using the SUMMARIZE function
When you want to get the totals for the data in your model, you can leverage the SUMMARIZE
function to create a DAX expression to return the data back as a table.
This recipe uses the SUMMARIZE
function on a single column. You will summarize the number of fatalities on the CRASH_DATA_T table by the numbers that are related to a weather condition. After building on this foundation, you will add additional columns and other options to round out the features available using this function.
How to do it...
Connect to the CHAPTER_9_DAX database in SQL Server Management Studio.
Right-click on the database, and select New Query | MDX to create a new MDX query window.
To determine the number of fatalities by weather condition you will use the
SUMMARIZE
function along with theEVALUATE
function to return a tableset:EVALUATE SUMMARIZE ( CRASH_DATA_T ,WEATHER_T[WEATHER_CONDITION] ,"Total Fatalities", SUM...