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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

change column colours according to the number of filled columns in matrix

Hello,

 

I haven't found a topic with the same question as mine (maybe I've looked wrong, it's possible, it's the first time I've searched on this forum), but I'd like to know, is it possible on power bi deskstop to make sure that if one column of the matrix is full, the row appears in one colour, and if all the columns are full, the row appears in another colour?

SansNom_1-1718609800038.png

Knowing that for the moment, I haven't found how to colour the first column which corresponds to the rows. I don't know if it's possible, but as you can colour everything on the tables, I thought it might be, but not necessarily. 

(In the matrix, I put three columns and just one column, and the column has only 2 different value like you can see)

If I haven't made myself clear, don't hesitate to ask me for more information!

 

Thank you in advance for your reply.

1 ACCEPTED SOLUTION
Daniel29195
Super User
Super User

@Anonymous 

create this measure; 

bg =
var ds =
SELECTCOLUMNS(
    CALCULATETABLE(
        'TableData',
        ALLSELECTED(TableData[Contrôleur])
    ),
    [Contrôleur],
    [Conformité]
)



var g_ds =
GROUPBY(
    ds,
    TableData[Conformité],
    "c" , COUNTX(CURRENTGROUP() , TableData[Contrôleur] )
)

 

RETURN
SWITCH(
    TRUE(),
    MAXX(g_ds , [c]  )  = 2  && MAXX(g_ds, [Conformité]) = "Oui" , "Green" ,
    MAXX(g_ds , [c]  )  = 2  && MAXX(g_ds, [Conformité]) = "Non" , "Red" ,
    "Orange"
)
 
then add a condtional formatting --> background color on the measure in the visual. 
 
 
 

View solution in original post

3 REPLIES 3
Daniel29195
Super User
Super User

@Anonymous 

create this measure; 

bg =
var ds =
SELECTCOLUMNS(
    CALCULATETABLE(
        'TableData',
        ALLSELECTED(TableData[Contrôleur])
    ),
    [Contrôleur],
    [Conformité]
)



var g_ds =
GROUPBY(
    ds,
    TableData[Conformité],
    "c" , COUNTX(CURRENTGROUP() , TableData[Contrôleur] )
)

 

RETURN
SWITCH(
    TRUE(),
    MAXX(g_ds , [c]  )  = 2  && MAXX(g_ds, [Conformité]) = "Oui" , "Green" ,
    MAXX(g_ds , [c]  )  = 2  && MAXX(g_ds, [Conformité]) = "Non" , "Red" ,
    "Orange"
)
 
then add a condtional formatting --> background color on the measure in the visual. 
 
 
 
Daniel29195
Super User
Super User

@Anonymous 

i think that your request is possible. 

however, it would be more clear to me, if you would share a power bi fule with sample data and the matrix visual.

 

you can share it on google drive , and share the link here. 

 

 

 

Anonymous
Not applicable

Hello @Daniel29195 

Thank you for your reply.


The fact that you tell me that it is possible reassures me, but on the other hand I can not transmit my data set, sorry... It is a confidential data set so it is impossible to transmit you even a part.
But to talk about the structure of the data, the interesting part corresponds to a column bearing the name of a control, a second column indicating whether the control was compliant or not, a last indicating who carried out the control (writer or verifier) and a last one indicating the time of the control.
If in my screenshot, we see that a control is grouped under two groups, it is because in fact each control belongs to a control set, and each control set belongs to an even larger set, but I don’t think it has any impact on what I want to do, maybe I’m wrong.

My matrix does not have more columns than those displayed in the previous screenshot, just much more row.
I don’t know if it’s clear enough in terms of the structure of the data to imagine something, don’t hesitate to tell me again.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors