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
Anonymous
Not applicable

Row value vs Average total conditional formatting

Hi All,

 

I have a simple table with value:

Col1  Col2

A       100

B       150

C       200

D      250

 

I want to highlight Col2 values which are less than the average of all the Col2 values(average is 175) as red and more than and equal to values as green. 100 and 150 will come as red and 200 and 250 will come as green. Is there a way I can acheive this?

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous ,

 

Create the following measure:

Condittional formatting  = IF(SUM('Table'[Column2]) <= AVERAGEX(ALLSELECTED('Table'[Column1];'Table'[Column2]);'Table'[Column2]);"Red";"Green")

 

Then just use this column to make the condittional formatting:

MFelix_0-1599737388244.png

 

You can change the "Red" "Green" to custom colour formatting using the HEX codes like this "#ffffff"

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

3 REPLIES 3
MFelix
Super User
Super User

Hi @Anonymous ,

 

Create the following measure:

Condittional formatting  = IF(SUM('Table'[Column2]) <= AVERAGEX(ALLSELECTED('Table'[Column1];'Table'[Column2]);'Table'[Column2]);"Red";"Green")

 

Then just use this column to make the condittional formatting:

MFelix_0-1599737388244.png

 

You can change the "Red" "Green" to custom colour formatting using the HEX codes like this "#ffffff"

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Greg_Deckler
Super User
Super User

@Anonymous - You can create a measure like:

Color Flag = 
  VAR __Average = AVERAGEX('Table',[Col2])
RETURN
  IF(MAX([Col2])<__Average,1,2)

You can use this measure in your conditional formatting rules. 1 is red, 2 is green. 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@Anonymous , One of the way is to condition formatting using measure with Option "Field Value"

Create a measure like this and choose it in conditional formatting after selecting "Field Value"

Color Date = if(FIRSTNONBLANK('Date'[Date],TODAY()) <today(),"lightgreen","red")

Color Date =
var _min =minx(allselected(Date,Date[Year])
return
 Switch( true(),
 FIRSTNONBLANK('Date'[Year],year(TODAY()))-_min =0 ,"lightgreen",
  FIRSTNONBLANK('Date'[Year],year(TODAY()))-_min =0 ,"blue",
 "red")

if(FIRSTNONBLANK(Table[Value],"true")= "true","green","red")

if(FIRSTNONBLANK(date[date],blank())= tofay(),"green","red")
if(max(date[date])= tofay(),"green","red")

 

 

Refer:https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-numbers-in-the-column
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

 

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.