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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
clem312
Resolver I
Resolver I

Function Background color

Hi,

 

I want to make a function for the background color of cells in a matrix.

Data are like this

clem312_0-1631862517127.png
I am trying to put the background color of Q73_lib cells with Q72_correspondance.Q72_lib_color
With conditional Formatting what I have tried so far didn't worked :

Q73_Background Color =
IF (MIN(Q73[Q72_correspondance.Q72_id_color])=1,"#ff99cc",
IF (MIN(Q73[Q72_correspondance.Q72_id_color])=4,"#ccccff",
IF (MIN(Q73[Q72_correspondance.Q72_id_color])=5,"#ffcc99")
etc.
))

 

2 ACCEPTED SOLUTIONS
clem312
Resolver I
Resolver I

Hi @amitchandak 

 

Thank you for your answer.

It's hard to put it in the matrix.

In line, I have a series to rank my measure :

RankT = GENERATESERIES(1,10)
In column, the brands
And two values :
Q73_Measure category = MAXX(FILTER(ADDCOLUMNS(SUMMARIZE(Q73, Q73[marques.make_lib], Q73[Q73_lib]), "line1", Q73[_%_Q73], "line2", [Q73_Rank], "line3", Q73[Q73_Make_order]), [line2]=MAX(RankT[Value])), Q73[Q73_lib])
and
Q73_Measure percent = MAXX(FILTER(ADDCOLUMNS(SUMMARIZE(Q73, Q73[marques.make_lib], Q73[Q73_lib]), "line1", Q73[_%_Q73], "line2", [Q73_Rank], "line3", Q73[Q73_Make_order]), [line2]=MAX(RankT[Value])), Q73[_%_Q73])

clem312_0-1631864984805.png


Clement

View solution in original post

v-xiaotang
Community Support
Community Support

Hi @clem312 

In your measure, it performs conditional formatting based on Q72_correspondance.Q72_id_color, but this column is not added in your matrix. So if this column can't be added to the matrix, you should look for other column to replace it. Otherwise, it is difficult to perform conditional formatting.

For more details about conditional formatting, you can review this article,

vxiaotang_0-1632303461431.png

https://www.sqlshack.com/conditional-formatting-in-power-bi-2/

 

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
clem312
Resolver I
Resolver I

@v-xiaotang @amitchandak 

Thank you. Finally worked. 
I created a measure MIN(Id_color) in my table and Background color and it worked ! Even without adding id_color in the matrix

clem312_0-1632394669532.png

 

clem312_1-1632394724682.png

 

v-xiaotang
Community Support
Community Support

Hi @clem312 

In your measure, it performs conditional formatting based on Q72_correspondance.Q72_id_color, but this column is not added in your matrix. So if this column can't be added to the matrix, you should look for other column to replace it. Otherwise, it is difficult to perform conditional formatting.

For more details about conditional formatting, you can review this article,

vxiaotang_0-1632303461431.png

https://www.sqlshack.com/conditional-formatting-in-power-bi-2/

 

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-xiaotang 

 

Even inserting Q72_correspondance.Q72_id_color in the matrix doesn't change the background color.

Hi @clem312 

Thanks for your feedback. Could you show me how you set conditional formatting in matrix?

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

clem312
Resolver I
Resolver I

Hi @amitchandak 

 

Thank you for your answer.

It's hard to put it in the matrix.

In line, I have a series to rank my measure :

RankT = GENERATESERIES(1,10)
In column, the brands
And two values :
Q73_Measure category = MAXX(FILTER(ADDCOLUMNS(SUMMARIZE(Q73, Q73[marques.make_lib], Q73[Q73_lib]), "line1", Q73[_%_Q73], "line2", [Q73_Rank], "line3", Q73[Q73_Make_order]), [line2]=MAX(RankT[Value])), Q73[Q73_lib])
and
Q73_Measure percent = MAXX(FILTER(ADDCOLUMNS(SUMMARIZE(Q73, Q73[marques.make_lib], Q73[Q73_lib]), "line1", Q73[_%_Q73], "line2", [Q73_Rank], "line3", Q73[Q73_Make_order]), [line2]=MAX(RankT[Value])), Q73[_%_Q73])

clem312_0-1631864984805.png


Clement

amitchandak
Super User
Super User

@clem312 , In this case, Q73[Q72_correspondance.Q72_id_color] should be used in the matrix (or min of the context will be used)

 

Try like this. Used this measure in conditional formatting using the field values option

 

Q73_Background Color =
Switch (true() ,

MIN(Q73[Q72_correspondance.Q72_id_color])=1,"#ff99cc",
MIN(Q73[Q72_correspondance.Q72_id_color])=4,"#ccccff",
MIN(Q73[Q72_correspondance.Q72_id_color])=5,"#ffcc99"

)

 

PowerBI Abstract Thesis: How to do conditional formatting by measure and apply it on pie?: https://youtu.be/RqBb5eBf_I4

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.