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
rsanyoto
Helper III
Helper III

Uso de variable para devolver valores de max

Hola a todos,

Estoy atascado con el siguiente scenairo:

Tengo un informe que muestra las medidas visualizadas en Slicer e infografías relacionadas como gráficos de barras, tablas, etc.

Me gustaría crear una medida basada en los siguientes requisitos:

  1. Si se selecciona una de las medidas "groei.." o "instroom.." en la variable Firsmonth en la segmentación, muestre la salida basada en el máximo del campo Bezetting[Month]. Otro blanco sabio.
  2. Si una de las medidas "uitstroom..." se selecciona en la variable Secondmonth en la segmentación, muestre el outpute basado en el máximo del campo Bezetting[Uistroom Month]. Otro blanco sabio.

Actualmente tengo la siguiente medida, pero por desgracia no funciona.

Medida B ?

VAR FirstMonth - IF(
SWITCH(TRUE(),
VALUES("Crecimiento de números clave"[Cifras clave de crecimiento]) - "% de crecimiento el mes pasado",'Crecimiento de números clave'[crecimiento % mnd],
VALUES("Crecimiento de números clave"[Cifras clave de crecimiento]) - "% de crecimiento últimos 12 meses",'Crecimiento de números clave'[crecimiento % 12 mnd],
VALUES("Key numbers growth"[Cifras clave de crecimiento]) - "Crecimiento en número de mdw el mes pasado",'Key numbers growth'[número de crecimiento mnd],
VALUES("Key numbers growth"[Cifras clave de crecimiento]) - "Crecimiento en número de mdw los últimos 12 meses",'Key numbers growth'[número de crecimiento 12 mnd],
VALUES("Key numbers growth"[Números clave de crecimiento]) - "Número de MDW introducido el mes pasado",'Key numbers growth'[mnd inflow],
VALUES("Key numbers growth"[Números clave de crecimiento]) - "Número de mdw introducido en los últimos 12 meses",'Key numbers growth'[inflow 12 mnd]),
MAX(Ocupación[mes]),
BLANK())

VAR SecondMonth - IF(
SWITCH(TRUE(),
VALUES("Key numbers growth"[Números clave de crecimiento]) - "Número de mdw fluyó el mes pasado",'Key numbers growth'[outflow mnd],
VALUES("Key numbers growth"[Números clave de crecimiento]) - "Número de mdw fluído los últimos 12 meses",'Key numbers growth'[outflow 12 mnd]),
MAX(Ocupación[salida de mes]),
BLANK())

devolver BLANK()

No puedo encontrar ninguna solución para cambiar mi medida actual. Cualquier ayuda / sugerencias sería muy bienvenida.

¡Atentamente!

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

No @rsanyoto ,

El último retorno de la función que utilizó debe ir seguido del valor que desea mostrar. Usted devuelve blank() aquí, por lo que los resultados deben estar vacíos

Si tiene un requisito de fecha aquí, puede escribir de la siguiente manera:

Measure B = 
VAR _FirstMonth = IF(
SWITCH(TRUE(),
VALUES('Kengetallen groei'[Groei kengetallen]) = "Groei % afgelopen maand",'Kengetallen groei'[groei % mnd],
VALUES('Kengetallen groei'[Groei kengetallen]) = "Groei % laatste 12 maand",'Kengetallen groei'[groei % 12 mnd],
VALUES('Kengetallen groei'[Groei kengetallen]) = "Groei in aantal mdw afgelopen maand",'Kengetallen groei'[groei aantal mnd],
VALUES('Kengetallen groei'[Groei kengetallen]) = "Groei in aantal mdw laatste 12 maand",'Kengetallen groei'[groei aantal 12 mnd],
VALUES('Kengetallen groei'[Groei kengetallen]) = "Aantal mdw ingestroomd afgelopen maand",'Kengetallen groei'[instroom mnd],
VALUES('Kengetallen groei'[Groei kengetallen]) = "Aantal mdw ingestroomd laatste 12 maand",'Kengetallen groei'[instroom 12 mnd]),
MAX(Bezetting[Month]),
BLANK())

VAR _SecondMonth = IF(
SWITCH(TRUE(),
VALUES('Kengetallen groei'[Groei kengetallen]) = "Aantal mdw uitgestroomd afgelopen maand",'Kengetallen groei'[uitstroom mnd],
VALUES('Kengetallen groei'[Groei kengetallen]) = "Aantal mdw uitgestroomd laatste 12 maand",'Kengetallen groei'[uitstroom 12 mnd]),
MAX(Bezetting[Uitstroom month]),
BLANK())

return 
SWITCH(TRUE(),
date = date1, _FirstMonth,
date = date2, _SecondMonth,
blank())

Para el uso de VaR, puede ver los siguientes documentos:

https://dax.guide/st/var/

Si mi respuesta no es la que necesita, ¿puede compartir datos de ejemplo y salida de ejemplo en formato de tabla? O una muestra de pbix después de eliminar datos confidenciales.

Saludos

Liu Yang

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

View solution in original post

1 REPLY 1
v-yangliu-msft
Community Support
Community Support

No @rsanyoto ,

El último retorno de la función que utilizó debe ir seguido del valor que desea mostrar. Usted devuelve blank() aquí, por lo que los resultados deben estar vacíos

Si tiene un requisito de fecha aquí, puede escribir de la siguiente manera:

Measure B = 
VAR _FirstMonth = IF(
SWITCH(TRUE(),
VALUES('Kengetallen groei'[Groei kengetallen]) = "Groei % afgelopen maand",'Kengetallen groei'[groei % mnd],
VALUES('Kengetallen groei'[Groei kengetallen]) = "Groei % laatste 12 maand",'Kengetallen groei'[groei % 12 mnd],
VALUES('Kengetallen groei'[Groei kengetallen]) = "Groei in aantal mdw afgelopen maand",'Kengetallen groei'[groei aantal mnd],
VALUES('Kengetallen groei'[Groei kengetallen]) = "Groei in aantal mdw laatste 12 maand",'Kengetallen groei'[groei aantal 12 mnd],
VALUES('Kengetallen groei'[Groei kengetallen]) = "Aantal mdw ingestroomd afgelopen maand",'Kengetallen groei'[instroom mnd],
VALUES('Kengetallen groei'[Groei kengetallen]) = "Aantal mdw ingestroomd laatste 12 maand",'Kengetallen groei'[instroom 12 mnd]),
MAX(Bezetting[Month]),
BLANK())

VAR _SecondMonth = IF(
SWITCH(TRUE(),
VALUES('Kengetallen groei'[Groei kengetallen]) = "Aantal mdw uitgestroomd afgelopen maand",'Kengetallen groei'[uitstroom mnd],
VALUES('Kengetallen groei'[Groei kengetallen]) = "Aantal mdw uitgestroomd laatste 12 maand",'Kengetallen groei'[uitstroom 12 mnd]),
MAX(Bezetting[Uitstroom month]),
BLANK())

return 
SWITCH(TRUE(),
date = date1, _FirstMonth,
date = date2, _SecondMonth,
blank())

Para el uso de VaR, puede ver los siguientes documentos:

https://dax.guide/st/var/

Si mi respuesta no es la que necesita, ¿puede compartir datos de ejemplo y salida de ejemplo en formato de tabla? O una muestra de pbix después de eliminar datos confidenciales.

Saludos

Liu Yang

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

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.