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

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.

Reply
Syndicate_Admin
Administrator
Administrator

Matrix. Conditional format.

I have a problem with an array and conditional formatting.

I have moved from powerbi to excel my case to tell it better.

I want to highlight in blue for each reception center, which is the animal that they have the most.

I'm really stuck and I can't finish this task at work.

Thanks a lot.

Greetings

Screenshot_1.png

1 ACCEPTED SOLUTION

OK. Got it. Here is a solution.

1) Create a (new) dimension table for the "Departamento al que pertenece o al que está adscrito" using:

 

Dim Departemento = DISTINCT('Tabla madre'[Departamento al que pertenece o al que está adscrito])

 

Create a 1:N relationship between the corresponding fields in the tables:

model.JPG

 

Now create the following measures:

 

Num Filas = COUNT('Tabla madre'[Unidad a la que pertenece:])

 

And for the conditional formatting:

 

Condicion Pregunta1 =
IF (
    MAXX (
        ADDCOLUMNS (
            SUMMARIZE (
                ALL ( 'Tabla madre' ),
                'Tabla madre'[Departamento al que pertenece o al que está adscrito],
                'Tabla madre'[Unidad a la que pertenece:]
            ),
            "mx", [Num Filas]
        ),
        [mx]
    ) = [Num Filas],
    1
)

 

 

Create the table visual using the field from the Dim Departemento table for the rows, the Tabla Madre [Undidad a la que pertenece] as columns, add the [Num filas] as values, and set the conditional formatting with the corresponding measure. And you get this:

result.JPG

 

I've attached your sample file





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

19 REPLIES 19
PaulDBrown
Community Champion
Community Champion

What's the structure of the data table?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






The table has more than 20 columns.

Try creating a new table visual with the field "Departamento al que pertenece o al que esta adscrito" and the following equivalent measure:

Max por Centro = MAXX(ALLEXCEPT('Table', 'Table'[Centro]), [Num Animales])

 

In my example, you get this:

max value.JPG

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Thank you very much for all this great help but I can't figure it out.

In this link you can see a copy of my power bi: https://we.tl/t-pWNDfTrhnY

Maybe you see the best solution as well.

OK. Got it. Here is a solution.

1) Create a (new) dimension table for the "Departamento al que pertenece o al que está adscrito" using:

 

Dim Departemento = DISTINCT('Tabla madre'[Departamento al que pertenece o al que está adscrito])

 

Create a 1:N relationship between the corresponding fields in the tables:

model.JPG

 

Now create the following measures:

 

Num Filas = COUNT('Tabla madre'[Unidad a la que pertenece:])

 

And for the conditional formatting:

 

Condicion Pregunta1 =
IF (
    MAXX (
        ADDCOLUMNS (
            SUMMARIZE (
                ALL ( 'Tabla madre' ),
                'Tabla madre'[Departamento al que pertenece o al que está adscrito],
                'Tabla madre'[Unidad a la que pertenece:]
            ),
            "mx", [Num Filas]
        ),
        [mx]
    ) = [Num Filas],
    1
)

 

 

Create the table visual using the field from the Dim Departemento table for the rows, the Tabla Madre [Undidad a la que pertenece] as columns, add the [Num filas] as values, and set the conditional formatting with the corresponding measure. And you get this:

result.JPG

 

I've attached your sample file





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Thank you very much, this was really advanced for my level. Thank you very much.

yea, sometimes DAX gets tricky. I'm glad we worked it out.

If the problem has been solved, can you please mark the relevant post as the solution? This will close the thread and help others looking for a similar solution. Thank you.





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Syndicate_Admin
Administrator
Administrator

Screenshot_8.png

amitchandak
Super User
Super User

@Syndicate_Admin , if these three are measures or columns (Then on their measure), Create the following color measure and use them in conditional formatting using field value option

 

color Perro = if( [Perro] >[Gato] && [Perro] > [Iguanas], "Blue", "White")

 

color Gato = if( [Perro] <[Gato] && [Gato] > [Iguanas], "Blue", "White")

 

color Iguanas = if( [Iguanas] >[Gato] && [Perro] < [Iguanas], "Blue", "White")

 

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Dog, Cat and Iguana are inside a column called Animal.

Screenshot_2.png

Try this.

Measure to count animals by centro:

Num Animales = COUNTROWS('Table')

 

Measure to use in the conditional formatting interface:

Condit Format = 
IF(MAXX(ALLEXCEPT('Table','Table'[Centro]), [Num Animales]) = [Num Animales], 1)

 

condform.JPG

 

result.JPG

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Thank you very much for your help.

I have applied what you have told me and in the example of dogs and cats it works perfectly but when I use it in official work it does not work.

I show you in images.

Screenshot_2.pngScreenshot_3.pngScreenshot_4.pngScreenshot_5.png

Change the "Porcentaje" to "Número"

Captura.JPG

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






I get the same result 😞

Screenshot_6.pngScreenshot_7.png

Captura.JPG

 

You haven't changed it. The parameter is still "Porcentaje". Change it to "Número"





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






I've tried with number and neither.

Screenshot_9.png

The array is configured as follows:

Screenshot_8.png

Extra information: in my Mother Table, where I have all the information I have multiple columns (approx. about 20). Could that be because of that?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.