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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Valor de fila vs Formato condicional total promedio

Hola a todos

Tengo una tabla simple con valor:

Col1 Col2

A 100

B 150

C 200

D 250

Quiero resaltar los valores Col2 que son menores que el promedio de todos los valores Col2 (el promedio es 175) como rojo y más que e igual a los valores como verde. 100 y 150 vendrán en rojo y 200 y 250 vendrán en verde. ¿Hay alguna manera de lograr esto?

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hola @Aditya-Upadhyay ,

Cree la siguiente medida:

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

A continuación, sólo tiene que utilizar esta columna para hacer el formato condittional:

MFelix_0-1599737388244.png

Puede cambiar el formato "Rojo" "Verde" a color personalizado utilizando los códigos HEX como este "#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

Hola @Aditya-Upadhyay ,

Cree la siguiente medida:

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

A continuación, sólo tiene que utilizar esta columna para hacer el formato condittional:

MFelix_0-1599737388244.png

Puede cambiar el formato "Rojo" "Verde" a color personalizado utilizando los códigos HEX como este "#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

@Aditya-Upadhyay - Puede crear una medida como:

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

Puede usar esta medida en las reglas de formato condicional. 1 es rojo, 2 es verde.


@ 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

@Aditya-Upadhyay , Una de las maneras es condicionar el formato usando la medida con la opción "Valor de campo"

Cree una medida como esta y ócela en formato condicional después de seleccionar "Valor de campo"

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")

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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.