Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi Team, We need to change Matrix cell color based on the other column cell value.
apply different color coding for back and forth cells in each row considering single cell value as threshold in pi matrix.
We have two columns Measure 1 and Measure 2 ,where we have to show two colors(Red, green) for
the values of measure 1 start with red color and then when they reach the target value (here -5) they become green
until the last observed value in a cell, after that the empty cells are white. The color should be changed based on the target value.
Here user will change the target value manually(like,-5,-4 or -6)
Thanks in Advance.
Solved! Go to Solution.
Hi @RajkumarAdepu ,
I created some data:
Here are the steps you can follow:
1. In Power query. Add Column – Index Column – From 1.
2. Create calculated column.
IF =
var _mod=
MOD('Table'[Index],3)
return
IF(_mod=1,1,0)
Group_Index =
SUMX(FILTER(ALL('Table'),'Table'[Index]<=EARLIER('Table'[Index])),[IF])
Rank =
RANKX(FILTER(ALL('Table'),'Table'[Group_Index]=EARLIER('Table'[Group_Index])),[Index],,ASC)
3. Create measure.
Color =
var _index=
SUMX(FILTER(ALLSELECTED('Table'),'Table'[Group_Index]=MAX('Table'[Group_Index])&&[Measure]=-5),[Rank])
return
IF(
MAX('Table'[Rank])<_index,"red","green")
4. Value -- Conditional formatting – Background color.
5. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @RajkumarAdepu ,
I created some data:
Here are the steps you can follow:
1. In Power query. Add Column – Index Column – From 1.
2. Create calculated column.
IF =
var _mod=
MOD('Table'[Index],3)
return
IF(_mod=1,1,0)
Group_Index =
SUMX(FILTER(ALL('Table'),'Table'[Index]<=EARLIER('Table'[Index])),[IF])
Rank =
RANKX(FILTER(ALL('Table'),'Table'[Group_Index]=EARLIER('Table'[Group_Index])),[Index],,ASC)
3. Create measure.
Color =
var _index=
SUMX(FILTER(ALLSELECTED('Table'),'Table'[Group_Index]=MAX('Table'[Group_Index])&&[Measure]=-5),[Rank])
return
IF(
MAX('Table'[Rank])<_index,"red","green")
4. Value -- Conditional formatting – Background color.
5. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
apply different color coding for back and forth cells in each row considering single cell value as threshold in pi matrix
Hi @RajkumarAdepu ,
I advice you this article about conditional formatting
https://www.myonlinetraininghub.com/conditional-formatting-in-power-bi-tables-and-matrices
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you Mangaus1111. I have little bit elaborated my query. Please suggest.
We have two columns Measure 1 and Measure 2 ,where we have to show two colors(Red, green) for
the values of measure 1 start with red color and then when they reach the target value (here -5) they become green
until the last observed value in a cell, after that the empty cells are white. The color should be changed based on the target value.
Here user will change the target value manually(like,-5,-4 or -6)