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

Formato condicional basado en el promedio de ID

Datos sin procesar que tengo:

ID | Date | Num
A, Jan-1, 1
A, Jan-2, 2
A, Jan-3, 3
B, Jan-1, 11
B, Jan-2, 22
B, Jan-3, 33
C, Jan-1, 111
C, Jan-2, 222
C, Jan-3, 333

por ID Medida Promedio que creé:

Avg = var m = FIRSTNONBLANK(Source[ID], "")
return CALCULATE(AVERAGE(Source[Num]), FILTER(ALLSELECTED(Source),m =Source[id]))


Matriz visual que quiero crear pero falló - Quiero marcar los siguientes por ID avg en rojo, > en azul.

IdEnero-1Enero-2Enero-3por ID Avg
A1232
B11223322
C111222333222

Espero que esté claro y apreciando su guía!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@qucikq1 , Crear una medida de color como y utilizar la opción con "valor de campo" en formato condicional

Color  = if(FIRSTNONBLANK(Table[Year],2014) <=2016 && AVERAGE(Sales[Sales Amount])<170 
,"lightgreen",if(FIRSTNONBLANK(Table[Year],2014)>2018,"red","yellow"))
Color sales = if([Sales Today] -[sales yesterday]>0,"green","red")

color =
switch ( true(),
FIRSTNONBLANK(Table[commodity],"NA") ="commodity1" && sum(Table[Value]) >500,"lightgreen",
FIRSTNONBLANK(Table[commodity],"NA") ="commodity2" && sum(Table[Value]) >1000,"lightgreen",
/// Add more conditions
"red"
)

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

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

@qucikq1 - Lo hice de esta manera:

Flag = 
    VAR __Num = MAX([Num])
    VAR __ID = MAX([ID])
RETURN
    IF(AVERAGEX(FILTER(ALL('Table (15)'),[ID]=__ID),[Num])>__Num,1,0)

PBIX se adjunta a continuación sig, Tabla 15, Página 15.


@ 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

@qucikq1 , Crear una medida de color como y utilizar la opción con "valor de campo" en formato condicional

Color  = if(FIRSTNONBLANK(Table[Year],2014) <=2016 && AVERAGE(Sales[Sales Amount])<170 
,"lightgreen",if(FIRSTNONBLANK(Table[Year],2014)>2018,"red","yellow"))
Color sales = if([Sales Today] -[sales yesterday]>0,"green","red")

color =
switch ( true(),
FIRSTNONBLANK(Table[commodity],"NA") ="commodity1" && sum(Table[Value]) >500,"lightgreen",
FIRSTNONBLANK(Table[commodity],"NA") ="commodity2" && sum(Table[Value]) >1000,"lightgreen",
/// Add more conditions
"red"
)

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

Anonymous
Not applicable

color -switch hacer el truco! No creí que pueda ser tan fácil.

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.