Forum Discussion
jaryszek
7 months agoSuper User
Power BI conditional formatting using a disconnected table
Hello, I have a Power BI model with a fact table that contains budget values (both positive and negative) by date, department, and account, and I’m displaying the data in a matrix. I want to ha...
- 7 months ago
Use this as Field value for background/font color:
[Budget Color] = VAR v = [Budget] RETURN IF ( ISBLANK ( v ), BLANK(), MAXX ( FILTER ( Fmt_BudgetRules, v >= Fmt_BudgetRules[MinValue] && v < Fmt_BudgetRules[MaxValue] ), Fmt_BudgetRules[ColorHex] ) )Format pane → Conditional formatting → Background color (or Font color) →
Format by: Field value
Based on field: [Budget Color]
ThxAlot
7 months agoSuper User
For fun only, a more sophisticated solution with simpler format mapping table and UDF,
fx_Color = (str_Type: string) =>
VAR __sum = [SUM BudgetAmount]
RETURN
MAXX(
CALCULATETABLE(
TOPN(
1,
Fmt_BudgetRules,
Fmt_BudgetRules[MinValue]
),
Fmt_BudgetRules[MinValue] <= __sum,
Fmt_BudgetRules[Target] = str_Type
),
Fmt_BudgetRules[Value]
)
- jaryszek7 months agoSuper User
Thank you,
it is great!