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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Syndicate_Admin
Administrator
Administrator

Aplicar el color de fondo a la tarjeta con una sola medida

Tengo tabla con 7 columnas

Sharmi_28_0-1717074228931.png

Estoy usando el objeto visual de la tarjeta nueva

Sharmi_28_1-1717074291294.png

Quiero aplicar el color de fondo usando una sola medida
Si SUM(Tabla[1]) > 1 , "Verde", "Rojo"
Si SUM(Tabla[2]) > 1 , "Verde", "Rojo"
Si SUM(Tabla[3]) > 1 , "Verde", "Rojo"
Si SUM(Tabla[4]) > 1 , "Verde", "Rojo"
Si SUM(Tabla[5]) > 1 , "Verde", "Rojo"
Si SUM(Tabla[6]) > 1 , "Verde", "Rojo"
Si SUM(Tabla[7]) > 1 , "Verde", "Rojo"

5 REPLIES 5
Syndicate_Admin
Administrator
Administrator

Sí, CF en segundo plano usando solo una medida como en su solicitud:

CF_Background = 
SWITCH(
    TRUE(),
    SUM(Test[Value]) > 1, "Green",
    "Red"
)

Sin embargo, también cambié la estructura en Power Query, quité la dinamización de los datos

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjVR0lEyNQMSBkBsZg5imZlCuUDJ2FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"1" = _t, #"2" = _t, #"3" = _t, #"4" = _t, #"5" = _t, #"6" = _t, #"7" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"1", Int64.Type}, {"2", Int64.Type}, {"3", Int64.Type}, {"4", Int64.Type}, {"5", Int64.Type}, {"6", Int64.Type}, {"7", Int64.Type}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {}, "Attribute", "Value")
in
    #"Unpivoted Columns"

para que se vea así:

Alex87_0-1717140333129.png

A continuación, utilicé el objeto visual Matric, eliminé en el panel de opciones los valores de las filas, apliqué el CF en el texto y el fondo

Alex87_1-1717140417816.png

@Alex87Muchas gracias

Syndicate_Admin
Administrator
Administrator

@Alex87
Gracias.
¿Aplicaste el color de fondo usando la medida?

Syndicate_Admin
Administrator
Administrator

lo más cercano que puedo conseguir es usando una matriz.

Alex87_0-1717081662042.png

Syndicate_Admin
Administrator
Administrator

Cree una medida de DAX:

CF_Background = 
SWITCH(
    TRUE(),
    SUM('Table'[1]) > 1, "Green",
    SUM('Table'[2]) > 1, "Green",
    SUM('Table'[3]) > 1, "Green",
    SUM('Table'[4]) > 1, "Green",
    SUM('Table'[5]) > 1, "Green",
    SUM('Table'[6]) > 1, "Green",
    SUM('Table'[7]) > 1, "Green",
    "Red"
)

Vaya al panel Formato del nuevo objeto visual de tarjeta, vaya a TARJETAS/(serie Todo) / Fondo / fx ==> Valor de campo == CF_Background

Alex87_0-1717078815066.png

Si responde a sus necesidades, marque mi respuesta como la solución. ¡Gracias!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors