To create a dynamic KPI card that allows threshold values to be selected by the user and causes the card to change colors in Power BI, follow through the following steps:
Create User-Selectable Thresholds
Make use of a What-if Parameter or a separate table containing threshold values (for example: "Low," "Medium," "High").
Allow for user threshold selection through a slicer.
2. Write a DAX Measure for Conditional Formatting
Build a measure that compares KPI values with the threshold selected and assigns a color accordingly.
Example DAX:
SelectedThreshold = SELECTEDVALUE(ThresholdTable[Threshold])
KPIColor =
SWITCH(TRUE(),
[KPI Value] < SelectedThreshold * 0.5, "Red",
[KPI Value] < SelectedThreshold, "Yellow",
"Green"
)
3. Apply Conditional Formatting
- In the KPI card visual, go to Format → Data Label / Background → Conditional Formatting and set it to use the KPIColor measure.