This Query related with thread "Exploring DAX Total Risk Rating Calculation Techniques"
Prompt
Total Risk Rating_new = SUMX(SUMMARIZE(Risk,Risk[Risk ID],“MaxRiskbyID”,MAX(Risk[Risk Rating])) ,[MaxRiskbyID])
Answer
The provided code snippet is written in DAX (Data Analysis Expressions), a formula expression language used in Analysis Services, which allows developers to manipulate data models in Business Intelligence.
DAX Code Explanation
The primary purpose of the DAX function in the given code snippet (Total Risk Rating_new = SUMX(SUMMARIZE(Risk,Risk[Risk ID],“MaxRiskbyID”,MAX(Risk[Risk Rating])) ,[MaxRiskbyID])
) is to calculate the total sum of the maximum risk ratings associated with each unique Risk IDs in the 'Risk' table.
The formula creates a new measure, Total Risk Rating_new
, with these main steps:
It groups the 'Risk' table by 'Risk ID' and calculates the maximum 'Risk Rating' for each 'Risk ID'. This is facilitated by the
SUMMARIZE
andMAX
functions.The
SUMX
function then computes the sum of these maximum risk ratings.
Detailed Walkthrough:
Total Risk Rating_new = SUMX(SUMMARIZE(Risk,Risk[Risk ID],“MaxRiskbyID”,MAX(Risk[Risk Rating])) ,[MaxRiskbyID])
Step 1: SUMMARIZE(Risk,Risk[Risk ID],“MaxRiskbyID”,MAX(Risk[Risk Rating]))
This creates a new summarized table which has 'Risk ID' from 'Risk' table as one column, and second column, 'MaxRiskbyID' contains the maximum Risk Rating for each 'Risk ID'.
Step 2: SUMX(<above summarized table> ,[MaxRiskbyID])
Finally, SUMX
function takes the summarized table from previous step and sums up the 'MaxRiskbyID' column from that table.
The result is stored in a new measure 'Total Risk Rating_new'.
This measure can be used in visualizations or other calculations where you need to refer to the total risk rating across the 'Risk' table.
For more detailed understanding, consider taking relevant DAX courses on Enterprise DNA platform.
Description
Explanation of DAX code calculating total sum of maximum risk ratings by unique Risk IDs in Business Intelligence data model.