Conditional Format using DAX

This goes step by step into setting up conditional formatting using new columns/measures in DAX

Query Viewer

Pull the distinct values you wish to conditional format

DISTINCT(SELECTCOLUMNS('Table','Column Name or Measure'))

DAX

Create a calculated column or measure using the SWITCH() formula. You can set it to background color, font clor, icons, and/or Web URL!

Column

Status Colors = 
VAR _s = 'Table'[Column]

RETURN
SWITCH(
	TRUE(),
	_s = "Closed","#ADADAD",
	_s = "Duplicate (closed)", "#777777",
	_s ="Open", "#E41A1C",
	_s = "Work In Progress", "#367DB7",
	_s = "Duplicate (open)", "#E41A1C",
	_s = "New", "#E41A1C"
)

Measure

Status Colors = 
VAR _s = [Measure]

RETURN
SWITCH(
	TRUE(),
	_s = "Closed","#ADADAD",
	_s = "Duplicate (closed)", "#777777",
	_s ="Open", "#E41A1C",
	_s = "Work In Progress", "#367DB7",
	_s = "Duplicate (open)", "#E41A1C",
	_s = "New", "#E41A1C"
)

Cell Elements

On tables and matrix visuals, you can set the field value to the value of a column or measure

Last updated