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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
Oguzhan0556
Helper I
Helper I

How to colorize a matrix whose columns and rows are of text type?

Hi,

 

I want to color the cells of the matrix. The properties of the matrix are as follows.

 

column name = KontakHavuzID0

Row name = KontakHavuzID

Values = ContactCode

 

I wrote the following DAX for this matrix and I was able to do the coloring I wanted from the Contiditional formatting part. The interesting thing is that even though these columns look like numbers, they are actually of text type, but PBI

understood the terms greater and less than.

 

Color =

var KontakHavuzID = SELECTEDVALUE(ForOneThree[KontakHavuzID])

var KontakHavuzID0 = SELECTEDVALUE(ForOneThree[KontakHavuzID0])

return

    SWITCH(

    TRUE(),

    KontakHavuzID = "Mevcut Değil", "",

    KontakHavuzID0 = "Mevcut Değil", "",

    KontakHavuzID > KontakHavuzID0, "#C8E5DC",

    KontakHavuzID < KontakHavuzID0, "#F7D6D6",

    KontakHavuzID = KontakHavuzID0, "#EFF1F2"   

    )

 

The problem starts here. In fact, each KontakHavuzID and KontakHavuzID0 has a description.

 

The columns containing the descriptions of the KontakHavuzID and KontakHavuzID0 columns are as follows: [Kontak Havuz ID - Mart 2023] and [Kontak Havuz ID - Şubat 2023]....

 

Now I need to use words instead of using ID in the row and column of the matrix. However, since the Words are TEXT, I cannot apply conditions such as greater than or less. The words have numerical equivalents in the same table, but I don't know how to associate them with each other with DAX. Below I share the relationships of the columns.

 

[Kontak Havuz ID - Mart 2023] --> KontakHavuzID

 

[Kontak Havuz ID - Şubat 2023] --> KontakHavuzID0

 

For a better understanding of the columns, I will give example values ​​from each column;

 

[Kontak Havuz ID - Mart 2023] --> "KPIS", "ZRLCN", "TUKKP"...

 

KontakHavuzID --> 3, 5, 8...

 

Oguzhan0556_0-1678951892288.png

 

Thank you all.

 

1 REPLY 1
lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

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

May 2025 Monthly Update

Fabric Community Update - May 2025

Find out what's new and trending in the Fabric community.