March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello,
I am making a scorecard for some metrics, which requires me to calculate grades for certain applications based on the severities of a number of security incidents. I have two tables, one with all of the security incidents indexed by Incident ID, and another which is a pivot table of the original which is grouped by the unique application name and is filtered by Scan Type.
Table1 (All incidents)
Incident ID | Application Name | IssuePriority | Scan Type |
001 | App1 | High | Threat Modeling |
002 | App2 | Medium | SCA |
003 | App2 | Low | Threat Modeling |
004 | App3 | Medium | SCA |
005 | App1 | High | Threat Modeling |
Table2 (Threat Modeling Grades)
Application Name | High | Medium | Low | Weighted Score | Grade |
App1 | 2 | 16 | C | ||
App2 | 1 | 5 | A |
The two tables have a many to one relationship through the Application Name columns. The Grade column in Table2 is calculated by comparing the Weighted Score to different constants to return a letter grade. [i.e `IF([Weighted Score] < 10, "A")`].
I have a scorecard page that shows the Grades for each scan type for each application. There is a slicer at the top to select the Application Name. However, not all applications use each scan type. This causes the Card visualization showing the Threat Modeling Grade to return (Blank) when I filter to an Application Name that does not have any Threat Modeling incidents. The card visualization is referencing the Grade column in its Fields. I understand this is happening because when I filter to this application, the grades column is now empty because the column does not exist anymore. For example, if I filter to App3, the above Table2 would be empty. However, I do not know how to reference the column to return a different value than (Blank) when the column itself does not exist. I would like to return a "-" if there are no related incidents. How can I do this?
Both the Grade and Weighted Score columns are calculated columns, not measures.
DAX code for Grade column (Quartile values are fixed constants):
Grade = IF(TMScoreTable[Weighted Score] == 0, "A+",
IF(TMScoreTable[Weighted Score] >= 1 && TMScoreTable[Weighted Score] <= TMScoreTable[B_Quartile], "A",
IF(TMScoreTable[Weighted Score] > TMScoreTable[B_Quartile] && TMScoreTable[Weighted Score] <=TMScoreTable[C_Quartile], "B",
IF(TMScoreTable[Weighted Score] > TMScoreTable[C_Quartile] && TMScoreTable[Weighted Score] <= TMScoreTable[D_Quartile], "C",
IF(TMScoreTable[Weighted Score] > TMScoreTable[D_Quartile] && TMScoreTable[Weighted Score] <= TMScoreTable[E_Quartile], "D",
IF(TMScoreTable[Weighted Score] > TMScoreTable[E_Quartile] && TMScoreTable[Weighted Score] <= TMScoreTable[F_Quartile], "E",
IF(TMScoreTable[Weighted Score] > TMScoreTable[F_Quartile], "F", "-")))))))
Any help would be appreaciated, thanks!
-Deven
Solved! Go to Solution.
I was able to resolve this by building the following measure which references the grade column.
TM Grade Not blank = IF(ISBLANK(FIRSTNONBLANK(TMScoreTable[Grade], TMScoreTable[Grade])), "-", FIRSTNONBLANK(TMScoreTable[Grade], TMScoreTable[Grade]))
I was able to resolve this by building the following measure which references the grade column.
TM Grade Not blank = IF(ISBLANK(FIRSTNONBLANK(TMScoreTable[Grade], TMScoreTable[Grade])), "-", FIRSTNONBLANK(TMScoreTable[Grade], TMScoreTable[Grade]))
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
134 | |
90 | |
90 | |
66 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
70 | |
68 |