Forum Discussion
Conditional Formatting value in a matrix against a different source's column
- 1 year ago
Create a measure to count the inputs (e.g., CountOfInputs = COUNT(InputsTable[InputID])).
Create a measure to compare the count against the threshold value from the other table:
If the threshold table has one value:
MatchThreshold = IF([CountOfInputs] = SELECTEDVALUE(ThresholdTable[TargetCount]), 1, 0)If related by category or another key:
MatchThreshold = IF([CountOfInputs] = RELATED(ThresholdTable[TargetCount]), 1, 0)Optionally, create a color-returning measure:
MatchColor = IF([CountOfInputs] = RELATED(ThresholdTable[TargetCount]), "#FF0000", "#FFFFFF")Go to the matrix visual in Power BI.
Click the dropdown arrow on the values field.
Choose "Conditional formatting" > "Background color" or "Font color".
Set "Format by" to "Field value".
Choose the color measure (MatchColor) or logical measure (MatchThreshold) as the formatting field.
Apply the formatting.
Create a measure to count the inputs (e.g., CountOfInputs = COUNT(InputsTable[InputID])).
Create a measure to compare the count against the threshold value from the other table:
If the threshold table has one value:
MatchThreshold = IF([CountOfInputs] = SELECTEDVALUE(ThresholdTable[TargetCount]), 1, 0)
If related by category or another key:
MatchThreshold = IF([CountOfInputs] = RELATED(ThresholdTable[TargetCount]), 1, 0)
Optionally, create a color-returning measure:
MatchColor = IF([CountOfInputs] = RELATED(ThresholdTable[TargetCount]), "#FF0000", "#FFFFFF")
Go to the matrix visual in Power BI.
Click the dropdown arrow on the values field.
Choose "Conditional formatting" > "Background color" or "Font color".
Set "Format by" to "Field value".
Choose the color measure (MatchColor) or logical measure (MatchThreshold) as the formatting field.
Apply the formatting.