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
YunJ
Post Prodigy
Post Prodigy

Resultado incorrecto al poner una fecha diferente.

Hola

Escribí una medida como la siguiente:

Cuando pongo "Fecha de inicio" en la tabla, el resultado es correcto. Pero para las dos tablas inferiores, que puse "YearMonth" y "YearWeek" en la tabla, el resultado no es correcto. ¿Alguna solución para arreglar esto?

¡Muchas gracias por tu ayuda!

Capture.PNG

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hola @YunJ ,

En mi opinión, trate de crear su medida de la siguiente manera:

8 (2) =
CALCULATE (
    SUM ( timetest[Sales] ),
    FILTER (
        ALLSELECTED ( timetest ),
        timetest[Land Date] IN VALUES ( timetest[Start Date] )
            && timetest[Presale_or not] = "Y"
    )
)

8.PNG

Saludos

Icey

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

View solution in original post

8 REPLIES 8
Icey
Community Support
Community Support

Hola @YunJ ,

En mi opinión, trate de crear su medida de la siguiente manera:

8 (2) =
CALCULATE (
    SUM ( timetest[Sales] ),
    FILTER (
        ALLSELECTED ( timetest ),
        timetest[Land Date] IN VALUES ( timetest[Start Date] )
            && timetest[Presale_or not] = "Y"
    )
)

8.PNG

Saludos

Icey

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

Hola @Icey

Gracias por su gran solución.

¿Puedo preguntar por qué utiliza la función ALLSELECTED? y por qué usas

timetest[Land Date] IN VALUES ( timetest[Start Date] )

en lugar de

timetest[Land Date] = SELECTEDVALUE( timetest[Start Date] )

Gracias por su tiempo y paciencia!

Yun

Icey
Community Support
Community Support

Hola @YunJ ,

1. Utilizo ALLSELECTED() para eliminar los filtros de contexto de las columnas y filas de la consulta actual, conservando todos los demás filtros de contexto o filtros explícitos. Para obtener más información, consulte este blog: La guía definitiva de ALLSELECTED.

2. Si se utiliza SELECTEDVALUE(), la expresión solo funciona cuando un registro es "seleccionado". Pero utilice VALUES(), devolverá una lista de registros.

Saludos

Icey

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

Muchas @Icey! Leí el enlace y alguna fuente sobre ALLSELECTED. Pero todavía me pregunto por qué necesitamos eliminarlos filtros de contexto de columnas y filas?

Por cada fila tiene un valor único, ¿verdad? Así que no ignora los filtros de fila, ¿verdad?

(Lo siento soy nuevo en power bi, y lo siento si hago que mi pregunta sea tonta... todavía confundido acerca de TODOS los DAX de la familia, aunque aprender durante algún tiempo..)

Capture.PNG

Icey
Community Support
Community Support

Hola @YunJ ,

ALLSELECTED( timetest ) elimina todos los filtros de la tabla timetest, excepto los incluidos en esta página de informe.

Y la siguiente expresión es la razón por la que [Fecha de inicio] y [Semana del año] siguen funcionando como filtros. Puede intentar eliminarlo y el resultado será diferente.

timetest[Land Date] IN VALUES ( timetest[Start Date] )

Esto puede ser un poco difícil de entender. Se sugiere hacer referencia a algunos documentos y videos.

Documento:

Gestión de "todas" funciones en DAX: ALL, ALLSELECTED, ALLNOBLANKROW, ALLEXCEPT

Video:

La principal diferencia entre TODO Y ALLSELECTED - Power BI & DAX

Saludos

Icey

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

Gracias por compartir @Icey

parry2k
Super User
Super User

@YunJpor qué está utilizando la función allexcept? ¿Puede definir lo que está tratando de lograr?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hola @parry2k

Escribí allexcept(table[category]) para que mi segmentación de categoría pueda funcionar. Cuando solo utilicé all(table), la segmentación de categorías no funciona.

Gracias

Yun

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.