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
mterry
Helper V
Helper V

Pregunta sobre las agrupaciones

Me estoy enojendo con un problema con los datos de agrupación - Me gustaría tener en cuenta el orden cronológico y no estoy seguro de si es posible. Por ejemplo, con los datos siguientes, cuando agrupo por cantidad y uso la fecha mínima agrupa todas las cantidades juntas, regarldes de fecha, que se supone que sucede. Lo que me gustaría que pasara, es que revisara los datos cronológicamente e incorporara la fecha en que se agrupa - ver la segunda tabla a continuación. ¿Es posible hacer esto en Power Query?

FechaCantidad
1/1/20201000
2/1/20201500
3/1/20201500
4/1/20201000
5/1/20201500
6/1/20201500

Resultado deseado Resultado real
Primera fechaCantidad Fecha mínimaCantidad
1/1/20201000 1/1/20201000
2/1/20201500 2/1/20201500
4/1/20201000
5/1/20201500
3 REPLIES 3
v-yiruan-msft
Community Support
Community Support

Hola @mterry ,

Puede crear una columna calculada como se indica a continuación para lograrla:

First Date = 
VAR predate =
    CALCULATE (
        MAX ( 'Table'[Date] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Date] < EARLIER ( 'Table'[Date] ) )
    )
VAR predAmount =
    CALCULATE (
        MAX ( 'Table'[Amount] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Date] = predate )
    )
RETURN
    IF ( predAmount <> [Amount], 'Table'[Date] )

groupings.JPG

También se puede lograr mediante la creación de una medida, puede obtener todos los detalles en este archivo pbix de ejemplo.

Saludos

Rena

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.

Gracias a ambos, que ayudó a

amitchandak
Super User
Super User

@mterry, intenta como con una tabla de fechas

if(sum(table[Amount])- CALCULATE(sum(table[Amount]),PREVIOUSDAY(Date[Date]))-0, blank(),sum(table[Amount]))

O

sumx(filter(Summarize(Date,Date[Date],"_1",sum(table[Amount]),"_2", CALCULATE(sum(table[Amount]),PREVIOUSDAY(Date[Date]))),[_1]<>[_2]),[_1])

Para obtener lo mejor de la función de inteligencia del tiempo. Asegúrese de que tiene un calendario de fechas y que se ha marcado como la fecha en la vista de modelo. Además, únase a ella con la columna de fecha de su/s hecho/s. Consulte:
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

Vea si mi seminario web sobre Time Intelligence puede ayudar: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...


Apreciamos tus Felicitaciones.

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.