Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I have been struggling to figure out conditional formatting in what appears to a be a complex set up. I'd appreciate any help you can extend to resolve it.
I have the following matrix visual. The rows are attributes (att1 to att7). The columns contain calculated values for two tests A and B, each done with two methods x and y. I wish to conditionally color only columns for test B, based on a composite score of test A: if (Value[B][x] > Score[A][x], "Green"); if (Value[B][x] <= Score[A][x], "Red"). Similarly for Value[B][y] and Score[A][x].
Test | A | A | B | B |
Method | x | y | x | y |
att1 | 0.932 | 1.094 | ||
att2 | 1.201 | 1.208 | 1.201 | 1.208 |
att3 | 1.041 | 1.051 | 1.041 | 1.051 |
att4 | 0.969 | 0.977 | ||
att5 | 0.949 | 0.938 | 0.949 | 0.938 |
att6 | 0.928 | 1.024 | ||
att7 | 0.922 | 0.972 | 0.922 | 0.972 |
Score | 1.001 | 1.023 | 1.049 | 1.061 |
Thank you /j neskowin
Solved! Go to Solution.
Hi @neskowin ,
According to your description, here are my steps you can follow as a solution.
(1)My test data is the same as yours.
(2) We can create two measures.
measure = SUM('Table'[value])
color = var a=MAXX(FILTER(ALLSELECTED('Table'),[Test]="A"&&[attribute]="Score"&&[Method]="x"),[value])
var b=MAXX(FILTER(ALLSELECTED('Table'),[Test]="A"&&[attribute]="Score"&&[Method]="y"),[value])
return IF(OR(SELECTEDVALUE('Table'[Test])="A",SELECTEDVALUE('Table'[attribute])="Score"),"White",(IF(or(SELECTEDVALUE('Table'[Test])="B"&&SELECTEDVALUE('Table'[Method])="x"&&SUM('Table'[value])>a,SELECTEDVALUE('Table'[Test])="B"&&SELECTEDVALUE('Table'[Method])="y"&&SUM('Table'[value])>b),"green","red")))
(3)Set the conditional formatting as shown in the following figure and then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you very much. I knew I had to create a measure, but couldn't figure out referencing other columns.
Hi @neskowin ,
According to your description, here are my steps you can follow as a solution.
(1)My test data is the same as yours.
(2) We can create two measures.
measure = SUM('Table'[value])
color = var a=MAXX(FILTER(ALLSELECTED('Table'),[Test]="A"&&[attribute]="Score"&&[Method]="x"),[value])
var b=MAXX(FILTER(ALLSELECTED('Table'),[Test]="A"&&[attribute]="Score"&&[Method]="y"),[value])
return IF(OR(SELECTEDVALUE('Table'[Test])="A",SELECTEDVALUE('Table'[attribute])="Score"),"White",(IF(or(SELECTEDVALUE('Table'[Test])="B"&&SELECTEDVALUE('Table'[Method])="x"&&SUM('Table'[value])>a,SELECTEDVALUE('Table'[Test])="B"&&SELECTEDVALUE('Table'[Method])="y"&&SUM('Table'[value])>b),"green","red")))
(3)Set the conditional formatting as shown in the following figure and then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks. A follow-up question. The 'Table' in my project is a matrix visual created with a measure M1. In the matrix visual, the Rows are the attributes, the Columns are Tests and Methods, and the Values is the measure M1. The Score is in another matrix visual, but uses the same fields to compute the Score corresponding to the tests and methods, but using a different measure, M2. With your solution, do I now create a data table ('Table') from the matrix visuals, and if yes, is there a way to do it? If not, is there a way to refer to the matrix visual columns from your 'color' measure? Thank you.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
65 | |
63 | |
52 | |
37 | |
36 |
User | Count |
---|---|
82 | |
66 | |
61 | |
46 | |
45 |