In this recipe, you will use the ALL
function in the denominator of a percentage calculation. This ensures that you see all records in the calculation you are performing.
Complete the steps in the Using ALL to remove filters recipe to create the initial calculation and understand how ALL
ignores any filters.
On the CRASH_DATA_T table in the Grid view, select an empty cell under the CASENUMBER measure.
Enter the calculation in the formula bar:
Pct_of_Crashes:= COUNT(CRASH_DATA_T[CASENUMBER])/ CALCULATE ( COUNT(CRASH_DATA_T[CASENUMBER]), ALL(CRASH_DATA_T) )
Once you have done this, hit Enter.
The result returns a 1. To change the format to a percentage, edit the Format in the Properties window to Percentage.
The result will now show 100.00 %.
Deploy the model to the server by selecting the Build menu and the Deploy Chapter_9_DAX.
Switch to SQL Server Management...