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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Syndicate_Admin
Administrator
Administrator

cómo calcular con un filtro específico

Hola equipo,

Intenté obtener el valor de fila anterior de la columna "P" basado en la columna "Año" con debajo de DAX para agregar NUEVA columna "Previous_P",

ID de grupo estadísticoAñoP
11204220210
11204220220
11204220230
1120422024164.74
1120422025159.8
1120422026155.01
1120422027150.36
1120422028145.85
13716520210
13716520220
13716520230
13716520240
13716520258525.5
13716520268270.5
13716520278024
13716520287862.5

Previous_P = SUMX(FILTER(Sheet1,Sheet1[Year]=EARLIER(Sheet1[Year])-1),Sheet1[P])

después de aplicar por encima de DAX, pude obtener el siguiente resultado:

2021-10-18_14h15_17.png

pero lo que quiero es obtener "previous_P" con grupo de diferente valor de "Statistic Group ID".

alson2002_0-1634538316459.png

Intenté usar DAX como se muestra a continuación, pero no pude obtener los datos esperados:

Previous_P = 
CALCULATE(
SUMX('Sheet1',Sheet1[P]),
FILTER(Sheet1,Sheet1[Year]=(Sheet1[Year])-1),ALLEXCEPT(Sheet1,Sheet1[Statistic Group ID])
)

¿Podría apoyar para proponer cómo puedo obtener los datos esperados?

¡Gracias!

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

@alson2002 , Prueba como

Previous_P = SUMX(FILTER(Sheet1,Sheet1[Year]=EARLIER(Sheet1[Year])-1 && Sheet1[Statistic Group ID] =  earlier(Sheet1[Statistic Group ID] ) ),Sheet1[P])

View solution in original post

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

@alson2002 , Prueba como

Previous_P = SUMX(FILTER(Sheet1,Sheet1[Year]=EARLIER(Sheet1[Year])-1 && Sheet1[Statistic Group ID] =  earlier(Sheet1[Statistic Group ID] ) ),Sheet1[P])

Genial, gracias!!!

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors