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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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