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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.