- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Color code in DAX
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-13-2017 05:17 PM
hi PBI, Can you help with coding a DAX with color code. Can I insert a color code into the DAX so it comes out in RED or Green visually
eg below
Change = if([Growth])>0,"Grow","Decline")
Growth | Change
0.12 | Grow <auttomatically green in color
-0.04 | Decline <automatically red in color
Solved! Go to Solution.
Accepted Solutions
Re: Color code in DAX
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
10-17-2017 11:21 PM
Color coding in DAX is not possible, but as a workaround you can create two metrics:
metric1=if([Growth])>0,"Grow","")
metric1=if([Growth])<=0,"Decline","")
Add two card visuals to the report and pull metric1 into 1 card and metric2 into the other card. Now, change the font color for 1st card(where metric1 has been used) to green and 2nd card(where metric2 has been used) to red.
In this way, card 1 will show up only when [Growth])>0 and card 2 will show up only when [Growth])<=0
All Replies
Re: Color code in DAX
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-13-2017 09:32 PM
Conditional Formatting was just added to the visuals recently (June Power BI). It can't be used on the Text Entries but you could colour in the Growth column based on a range.
To do this, click on the Field in the Values area of your visualisations and select the down triangle to get the menu. The menu has conditional formatting and Color Scales.
Did I answer your question? Mark my post as a solution!
Proud to be a Datanaut!
Re: Color code in DAX
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-14-2017 07:30 PM
Hi @malcolmwun,
Current dax formula not support color code, I think you can post this requirement to ideas forum or use conditional formatting function to modify the display color.
Regards,
Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
For learning resources/Release notes, please visit: | |
Re: Color code in DAX
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
10-17-2017 11:21 PM
Color coding in DAX is not possible, but as a workaround you can create two metrics:
metric1=if([Growth])>0,"Grow","")
metric1=if([Growth])<=0,"Decline","")
Add two card visuals to the report and pull metric1 into 1 card and metric2 into the other card. Now, change the font color for 1st card(where metric1 has been used) to green and 2nd card(where metric2 has been used) to red.
In this way, card 1 will show up only when [Growth])>0 and card 2 will show up only when [Growth])<=0
Re: Color code in DAX
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
10-23-2017 10:51 PM
thanks.... although not ideal but works and i am using it now
Re: Color code in DAX
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-13-2018 09:29 AM
By creating "metric" do you mean adding new measure?
What do you mean by "pull metric1 into 1 card and metric2 into the other card"?
Re: Color code in DAX
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-13-2018 09:36 AM
By creating "metric" do you mean adding new measure?
What do you mean by "pull metric1 into 1 card and metric2 into the other card"?
Re: Color code in DAX
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-14-2018 02:44 AM