Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
RajkumarAdepu
New Member

undefined

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.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @RajkumarAdepu ,

I created some data:

vyangliumsft_0-1667976389184.png

Here are the steps you can follow:

1. In Power query. Add Column – Index Column – From 1.

vyangliumsft_1-1667976389187.png

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)

vyangliumsft_2-1667976389188.png

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.

vyangliumsft_3-1667976389190.png

 

vyangliumsft_4-1667976389194.png

5. Result:

vyangliumsft_5-1667976389195.png

 

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

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi  @RajkumarAdepu ,

I created some data:

vyangliumsft_0-1667976389184.png

Here are the steps you can follow:

1. In Power query. Add Column – Index Column – From 1.

vyangliumsft_1-1667976389187.png

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)

vyangliumsft_2-1667976389188.png

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.

vyangliumsft_3-1667976389190.png

 

vyangliumsft_4-1667976389194.png

5. Result:

vyangliumsft_5-1667976389195.png

 

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

RajkumarAdepu
New Member

apply different color coding  for back and forth cells in each row considering single cell value as threshold in pi matrix

 

mangaus1111
Solution Sage
Solution Sage

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)

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.