Hi PBI community,
Is there a way to change the background or font color of a table cell for a text based column using DAX.
Any help would be appreciated.
If you are looking to use DAX, here is an easy formula to use.
VAR Name1 = IF(SELECTEDVALUE('TABLE'[COLUMN]) = "TEXT", True, False)
VAR Name2 = IF(SELECTEDVALUE('TABLE'[COLUMN]) = "TEXT", True, False)
VAR Name3 = IF(SELECTEDVALUE('TABLE'[COLUMN]) = "TEXT", True, False)
Name1 , "COLOR",
You would just need to type in the table names and columns. This method would require you to type in all of the cell contents that you want to format, but it works great for smaller distinct value distributions.
Hi, I am working on a similar stuffs where I need the text to have colors. I have a rating column ratings=0 are detractors, raating=1 are promotors and rating =2 are passive. So I want the comments(text) associated with this ratings to follow the same color but it is not working is there a way to solve the problem
This method works perfectly in the Sept. 2021 version. Simply create a Calculated Column based on the original column using the method above (Hex color codes). Then do conditional formattting on the original field in a table or matrix and pick "Format by" > "Field value", "Based on field" > Your calculated column.
This post provides one method: https://exceleratorbi.com.au/conditional-formatting-with-a-text-field-in-power-bi/
The DAX is essentially:
I have found a solution which may help which I got help from one of my team members:
This one helped me solve a problem, one that blocked me all day, many thanks! I got as far as you did up to creating a column to be numbers assigned from another column that is Red, Amber, Green until the conditional formatting lost me, but you helped me solve that one.
The business logic was to calculate the number of months between now and a future date, then using business rules to create a RAG upon them.
Red -> Months to Expiry <=12
Amber -> Months to Expiry >12 and <=24
Green -> Months to Expiry >24
Exactly what I was looking for, thanks. Mind you, being able to apply a format directly to a field based on a text value doesn't seem like it would be that difficult. It's certainly been something that I could do in Excel for years - come on Microsoft.
I had the same problem and this is what I did:
- Create a new column
- Create an IF formula based on your text column, make it take numbers instead of the values. For example, my text column contained "Yes" and "No". I used the formula New column = IF([Textcolumn]="Yes",1,0).
- Go to the Conditional formatting option and chose to conditional format based on another column, chose your newly created column.
- You can do this with the first two types of conditional formatting: by color scale and by rules.
why is it if i choose conditional formating based on another column it automaticly uses SUM but i do not want it to sum just take the value
As an alternative you can use a measure to retrieve the first value for conditional formatting instead of column aggregation.
First Value = FIRSTNONBLANK('Table'[Column 1],'Table'[Column 1])
This idea is currently "Started":
I've been needing this functionality for months now.
Click here to read more about the November 2022 updates!
Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.
This session walks through creating a new Azure AD B2C tenant and configuring it with user flows and custom policies.