The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I need to format the background and text colors based on 2 columns. 1 is a numeric column and 1 is a text column. In excel the conditional formatting formula would be:
How do I accomplish this in Power BI desktop?
Solved! Go to Solution.
Hi,
In this case you could add a column or measure containing the the colour code you would like to assign with conditional formatting (a measure would be preferable if the condition depends on the aggregation, a calculated column would be preferable if every row of your table should get a colour assigned). Below you will find an example of a file with a calculated column and measure that assign a colour code when conditions are met. By adding conditional formatting based on a field value (select the visual > consitional formatting > advanced controls > format by: field value ) you make the visual apply this colour based on the result in the measure or calculated column.
Measure example:
Colour =
IF (
AND ( SUM ( 'Table'[Value] ) > 20, SUM ( 'Table'[Value] ) < 60 ),
"#FF0000",
BLANK ()
)
Column example:
ColumnColour =
IF (
AND ( 'Table'[Value] = 10, 'Table'[Category] = "Category A" ),
"#00FF00",
BLANK ()
)
Result:
Best regards,
Tim
Proud to be a Super User!
Hi,
In this case you could add a column or measure containing the the colour code you would like to assign with conditional formatting (a measure would be preferable if the condition depends on the aggregation, a calculated column would be preferable if every row of your table should get a colour assigned). Below you will find an example of a file with a calculated column and measure that assign a colour code when conditions are met. By adding conditional formatting based on a field value (select the visual > consitional formatting > advanced controls > format by: field value ) you make the visual apply this colour based on the result in the measure or calculated column.
Measure example:
Colour =
IF (
AND ( SUM ( 'Table'[Value] ) > 20, SUM ( 'Table'[Value] ) < 60 ),
"#FF0000",
BLANK ()
)
Column example:
ColumnColour =
IF (
AND ( 'Table'[Value] = 10, 'Table'[Category] = "Category A" ),
"#00FF00",
BLANK ()
)
Result:
Best regards,
Tim
Proud to be a Super User!
User | Count |
---|---|
80 | |
78 | |
37 | |
34 | |
31 |
User | Count |
---|---|
93 | |
81 | |
60 | |
49 | |
49 |