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
Post Patron
Post Patron

Problema con TODOS

Hola, chicos

Tengo la siguiente medida:

Total > 2 days = 
VAR MinDate = MIN(DateMaster[Date])
RETURN
    COUNTROWS(FILTER('Service Appointment',
    'Service Appointment'[IsWIP]=1 && 
    'Service Appointment'[WIP Days] > 2 &&
    'Service Appointment'[Actual Start Time] > MinDate))

En la parte superior de la página hay una segmentación de fecha única donde un usuario selecciona un mes.

Si el valor de la segmentación de datos es Sep 2020, quiero que la medida calcule todas las filas donde la fecha de inicio real > 1 sep 2020.

Intenté añadir TODO a mi medida, así:

Total > 2 days = 
VAR MinDate = MIN(DateMaster[Date])
RETURN
    COUNTROWS(FILTER(ALL('Service Appointment'),
    'Service Appointment'[IsWIP]=1 && 
    'Service Appointment'[WIP Days] > 2 &&
    'Service Appointment'[Actual Start Time] > MinDate))

Y aunque esto devuelve el número correcto de filas, cuando lo agredo a una matriz y me muestra el número total en cada fila, así:

Screenshot 2020-11-05 154902.png

Nota: No puedo cambiar la segmentación de datos para mostrar solo los datos después de la fecha seleccionada, ya que otros objetos visuales usan la misma segmentación de datos.

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

Hola @JimJim ,

Podemos crear una tabla de fechas que no tenga ninguna relación para satisfacer sus requisitos.

1. Cree una tabla de fechas para que sea una segmentación de datos. Debe agregar la columna de nombre de mes y la columna de número de mes,

Date = CALENDAR("2020/8/1","2020/12/31")

issue1.jpg

2. Entonces podemos crear una medida como esta,

Measure = 
var _select = SELECTEDVALUE('Date'[Month])
var _mindate = CALCULATE(MIN('Date'[Date]),FILTER('Date','Date'[Month]=_select))
return
COUNTROWS(
    FILTER(ALLSELECTED('Service Appointment'),'Service Appointment'[Start Date]>_mindate))

issue2.jpg

issue3.jpg

Si no cumple con sus requisitos, ¿podría mostrar el resultado esperado exacto basado en la tabla que ha compartido?

Saludos

Equipo de apoyo a la comunidad _ zhenbw

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

BTW, pbix como adjunto.

View solution in original post

6 REPLIES 6
v-zhenbw-msft
Community Support
Community Support

Hola @JimJim ,

Podemos crear una tabla de fechas que no tenga ninguna relación para satisfacer sus requisitos.

1. Cree una tabla de fechas para que sea una segmentación de datos. Debe agregar la columna de nombre de mes y la columna de número de mes,

Date = CALENDAR("2020/8/1","2020/12/31")

issue1.jpg

2. Entonces podemos crear una medida como esta,

Measure = 
var _select = SELECTEDVALUE('Date'[Month])
var _mindate = CALCULATE(MIN('Date'[Date]),FILTER('Date','Date'[Month]=_select))
return
COUNTROWS(
    FILTER(ALLSELECTED('Service Appointment'),'Service Appointment'[Start Date]>_mindate))

issue2.jpg

issue3.jpg

Si no cumple con sus requisitos, ¿podría mostrar el resultado esperado exacto basado en la tabla que ha compartido?

Saludos

Equipo de apoyo a la comunidad _ zhenbw

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

BTW, pbix como adjunto.

Hola @v-zhenbw-msft ,

Muchas gracias. Esto hace el trabajo 🙂

Mi antigua medida ahora está funcionando también, resulta que todo lo que tenía que hacer era eliminar las relaciones de mi tabla DateMaster.

amitchandak
Super User
Super User

@JimJim , tenga un filtro de fecha independiente y utilice solo la primera fórmula.

Suponiendo la hora de inicio real unida con Date master

Total > 2 days = 
VAR MinDate = MIN(DateMaster[Date])
RETURN
    COUNTROWS(FILTER(('Service Appointment'),
    'Service Appointment'[IsWIP]=1 && 
    'Service Appointment'[WIP Days] > 2 ,
    filter(all(DateMaster),DateMaster[Date]> MinDate))

@amitchandak

Edité tu DAX a esto

Total > 2 days = 
VAR MinDate = MIN(DateMaster[Date])
RETURN
COUNTROWS(FILTER('Service Appointment',
'Service Appointment'[IsWIP]=1 && 
'Service Appointment'[WIP Days] > 2 &&
FILTER(ALL(DateMaster), DateMaster[Date] > MinDate )))

Pero al obtener el error 'La expresión hace referencia a varias columnas. No se pueden convertir varias columnas en un valor escalar'

Realmente aprecio tu ayuda con esto.

Hola @amitchandak, gracias. Pero al recibir el mensaje de error 'Demasiados argumentos pasados a la función de filtro'

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.