cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Pbra
Frequent Visitor

Dax color formatting

Hello folks,

 

For a worldoverview I´m using the Global Launch Estimates map.

I needed an overview of the countries by color.

 

However, I want to add a column with the code of a specific color based on a value, see my example below:

 

Name             Value         Color

New York        1.001        Dax formula with Hex # codes from red to green based on value

Paris                900          Dax formula with Hex # codes from red to green based on value

Dublin             665          Dax formula with Hex # codes from red to green based on value

London           1.178       Dax formula with Hex # codes from red to green based on value

Barcelona       1.980       Dax formula with Hex # codes from red to green based on value

Madrid            2.095      Dax formula with Hex # codes from red to green based on value

Amsterdam     300         Dax formula with Hex # codes from red to green based on value

 

The codes needs to be based on the value and not on the name of the city.

 

Cheers!

1 ACCEPTED SOLUTION
Fsciencetech
Helper III
Helper III

Create measure for the color like below and use this measure in your value 

Color = IF(
         value>0,

       "#F40606", "#252423")

 

Fsciencetech_2-1635152238298.png

 

Fsciencetech_3-1635152290973.png

 


 

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @Pbra,

You can use a column to store the color code, then you need to enable condition formatting on your value field to use the 'color code' field values as formatting conditions.

Conditional table formatting in Power BI Desktop - Power BI | Microsoft Docs
Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Fsciencetech
Helper III
Helper III

Create measure for the color like below and use this measure in your value 

Color = IF(
         value>0,

       "#F40606", "#252423")

 

Fsciencetech_2-1635152238298.png

 

Fsciencetech_3-1635152290973.png

 


 

Helpful resources

Announcements
August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 24 without aka link and time 768x460.jpg

Ted's Dev Camp - July 28, 2022

Watch Session 24 of Ted's Dev Camp along with past sessions!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors