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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
vendersonalias0
Frequent Visitor

¿Cómo RANK por fecha MAX de cada grupo sin crear una segunda tabla?

Mis datos de origen tienen una tabla con los usuarios y cada venta que hacen se registra como una fila.

Mi objetivo es encontrar la última fecha en la que cada usuario realizó una venta y luego clasificar esas fechas en consecuencia con la última siendo 1.

Ejemplo de tabla

pbihelp.PNG

La fórmula que estoy usando para encontrar la fecha máxima está funcionando correctamente

Fecha máxima: CALCULATE(MAX('salestable'[Fecha]),ALLSELECTED('salestable'[Fecha]))
pero mi última medida de venta me está dando el ranking en relación con todas las fechas en lugar de la fecha máxima de cada grupo
mi salida prevista debería tener:
rango 2 en lugar de rango 4,
rango 3 en lugar de rango 7, etc.
Creo que está clasificando la fecha máxima de cada grupo frente a todas las fechas en la tabla en lugar de sólo los rangos por grupo.
Ultima Venta - RANKX(ALL('salestable'),[Max Date],,DESC,Dense)
No estoy seguro de si hay una mejor manera de hacer esto, pero la salida deseada es tener tarjetas que muestren los nombres de los últimos usuarios que hicieron una venta. (En los datos reales, hay como máximo 2 ventas / semana)
Mi idea era tener una tarjeta de varias filas con todos los usuarios filtrados rango 1, la segunda tarjeta sería usuarios filtrados al rango 2, etc. hasta 3-4. Probablemente hay una mejor manera de hacer esto, pero esto es lo que se me ocurrió, cualquier sugerencia o mejora sería bienvenida también.
¡Gracias!
¡Felices Fiestas!

5 REPLIES 5
v-yiruan-msft
Community Support
Community Support

No @vendersonalias0 ,

Puede crear una medida como se indica a continuación:

Last Sale =
RANKX (
    ALLSELECTED ( 'salestable' ),
    CALCULATE ( MAX ( 'salestable'[Date] ) ),
    ,
    DESC,
    DENSE
)

Last sale.JPG

Saludos

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

@vendersonalias0 tiene sentido, supongo que usó ALLEXCEPT ( Tabla, Tabla[Usuario]), ¿correcto?



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.

vendersonalias0
Frequent Visitor

Gracias por la ayuda chicos, lo suficientemente divertido cuando estaba creando un conjunto de datos ficticio que pasó a utilizar ALLEXCEPT en la fórmula MAX DATE, entonces ALLSELECTED en la última medida de fecha comenzó a funcionar... pbihelp.PNG

parry2k
Super User
Super User

@vendersonalias0 hay muchas maneras de lograrlo. Recomendaría poner datos de muestra en pbix y compartir a través de una unidad / google unidad y le conseguirá la solución.



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.

CNENFRNL
Community Champion
Community Champion

@vendersonalias0, francamente hablando, la complejidad de RANKX() está mucho más allá de las expectativas de uno, especialmente cuando se incluye otra medida en ella; transición de contexto se producen dos veces en un escenario de este tipo.

A menos que pegue algunos datos ficticios o un archivo pbix, es difícil crear una medida correcta que se ajuste a su escenario.


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors