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
JimJim
Helper V
Helper V

Formato condicional basado en otro valor

Hola

Tengo la siguiente medida:

Total SA WIP > 2 days = 
    CALCULATE(COUNTROWS('Service Appointment'),
        'Service Appointment'[IsWIP]=1,
        'Service Appointment'[WIP Days] >2)

Lo que se ve así cuando se agrega a mi matriz:

Screenshot 2020-11-11 144648.png

Tengo el requisito de aplicar el formato condicional, pero. el umbral de rag cambiará dependiendo de la región.

Para todas las regiones excepto NAM, los grupos de trapos serán '> 50' (rojo), '10 - 50' (ámbar) y '< 10' (verde)

Para NAM, los grupos de trapos serán '> 150' (rojo), '30 - 150' (ámbar) y '< 30' (verde)

¿Cómo puedo lograrlo?

4 REPLIES 4
JimJim
Helper V
Helper V

Por si acaso alguien está interesado, aquí está la medida terminada:

Colour = 
IF (
    FIRSTNONBLANK ( Location[Region], "NA" ) = "NAM",
    SWITCH (
        TRUE (),
        'Key Measures'[Total SA WIP > 2 days] < 30, "lightgreen",
        'Key Measures'[Total SA WIP > 2 days] <= 150, "orange",
        "red"
    ),
    SWITCH (
        TRUE (),
        'Key Measures'[Total SA WIP > 2 days] < 10, "lightgreen",
        'Key Measures'[Total SA WIP > 2 days] <= 50, "orange",
        "red"
    )
)
amitchandak
Super User
Super User

@JimJim , Crear una medida de color como el ejemplo dado y utilizarla en formato condicional con la opción de valor de campo

Color, ¿cuál es el color?
interruptor (true(),
FIRSTNONBLANK('Table'[commodity],"NA") en "commodity1" && sum('Table'[Value]) >500,"lightgreen",
FIRSTNONBLANK('Table'[commodity],"NA") en "commodity2" && sum('Table'[Value]) >1000,"lightgreen",
Añadir más condiciones
"Buen hotel"
)

referencia: 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

Increíble, gracias @amitchandak

Hola @amitchandak ,

Estoy tratando de que su solución funcione:

He creado la medida liko así:

color = 
switch ( true(),
FIRSTNONBLANK(Location[Region],"NA") = "NAM" && 'Key Measures'[Total SA WIP > 2 days] < 30,"green",
FIRSTNONBLANK(Location[Region],"NA") <> "NAM" && 'Key Measures'[Total SA WIP > 2 days] < 10,"green",
// Add more conditions
"red"
)

Cuando voy al formato condicional para las columnas, no puedo formatear en función del color, ya que la medida 'color' está atenuada

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.