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
chwostian
Frequent Visitor

¿Por qué el fondo del título del gráfico no cambiará su color en el valor de la medida?

Hola, chicos

Tengo un gráfico que quiero que el color de fondo de su título dependa del valor de una medida. La medida compara dos cadenas:

1. "Años: " & Year(NOW())

2. el valor de otra medida llamada areFiltersApplied que devuelve una cadena de filtros aplicados a la tabla a través de segmentaciones

Así es como se crea el areFiltersApplied:

areFiltersApplied á IF([isYearFiltered], "Years: " & [selectedYears], BLANK()) & IF([isQuarterFiltered], " Quarter: " & [selectedQuarters], BLANK()) & IF([isActivityFiltered], " Activity: " & [selectedActivity], BLANK()) & IF([isGroupFiltered], " Groups: " & [selectedGroups], BLANK()) & IF([isSystemFiltered], " System: " & [selectedSystems])
Se compone de otras medidas. Si se filtra una columna determinada, selecciona todos los valores distintos y los concatena. Vamos a desglosar la medida [selectedYears] como ejemplo:
SelectedYears ?
var selectedColumn - DISTINCT(VALUES(Drawings[Year]))
var sortedColumn á SAMPLE(COUNTROWS(selectedColumn), selectedColumn, [Year], ASC)
RETURN CONCATENATEX(sortedColumn, [Year] & "", ", ")
La medida final que se utiliza para establecer un color es esta:
coloredTitle ( colorTitle)
var color á IF(("Years: " & YEAR(NOW())) á [areFiltersApplied], "#FFFFFF", "#FFFF00")
COLOR RETURN
por lo que debe devolver el color blanco o amarillo. Cuando aplico la medida al fondo del título del gráfico usando este
chwostian_0-1607418135960.png

No obtengo el resultado como se esperaba. Me pongo amarillo aunque la comparación devuelve true. Usé una tabla para comprobar el valor de la medida coloredTitle (consulte el segundo círculo rojo). Devuelve true por lo tanto blanco (#FFFFFF)

chwostian_0-1607416796038.png

¿Alguien puede ayudar? ¿Qué me estoy perdiendo? Gracias por cualquier pista.

6 REPLIES 6
v-jayw-msft
Community Support
Community Support

No @chwostian,

No puede reproducir el escenario, considere compartir algún archivo de ejemplo con nosotros si no tiene ninguna información confidencial.

Saludos

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

Hola Jay, ¿puede este tema permanecer abierto sin mi reacción hasta algún momento del mes que viene? Reproducir no es tan simple. Me va a llevar un tiempo. No estoy seguro de cuáles son las reglas. Por favor, aconséjese. Gracias Jay

No @chwostian,

Seguro. Normalmente, los temas permanecerán abiertos a menos que su propietario los elimine. Incluso si el tema está marcado como resuelto, los usuarios todavía pueden verlo y responder a él.

El mejor respeto,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
AllisonKennedy
Super User
Super User

No estoy seguro sin tener acceso al informe. ¿Qué filtros afectan a cada objeto visual? https://docs.microsoft.com/en-us/power-bi/create-reports/power-bi-report-filter

¿Puede simular con datos de muestra y compartir informes con el mismo problema? Si convierte el objeto visual de mosaico de tarjeta en un gráfico de columnas, ¿afecta eso al título? Si empieza a agregarle los otros campos, ¿afecta eso al título? Intente convertir el icono de la tarjeta lentamente en el gráfico de columnas y tome nota de cuándo el título cambia de 'blanco' a 'verde'. Si no cambia, entonces encuentre la diferencia entre los dos gráficos. Espero que algo ahí dentro ayude???


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

chwostian
Frequent Visitor

Hola @AllisonKennedy Allison, la mesa es la misma. Después de haber usado coloredTitle en una tarjeta (valor y título) y en el título de un gráfico obtuve dos resultados diferentes:

chwostian_2-1607430616730.png

Gracias

AllisonKennedy
Super User
Super User

¿Cuál es la diferencia entre la tabla que está utilizando para comprobar y el título visual?

¿Puede intentar usar el formato condicional para cambiar el texto del título y ver lo que devuelve cuando usa la medida [coloredtitle]? Inténtelo de nuevo con la medida [arefiltersapplied].

Es probable que sea algún contexto que se pase por alto.


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

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.