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
Zabeer
Helper I
Helper I

Restar filas basadas en otra categoría de columna

Hola

Me gustaría crear una nueva columna que restaría los valores de fila en 'FH' basado en el 'Producto'. El conjunto de datos de ejemplo y la salida esperada correspondiente se muestran a continuación. Por favor, ayúdeme.
Gracias.

ProductoFhResultado esperado
A20000
A50003000
A90004000
B25000
B60003500
B100004000

3 REPLIES 3
Syndicate_Admin
Administrator
Administrator

@Zabeer , Prueba como una nueva columna

Esperado = [FH] - maxx(filter(table,[Product] = earlier([Product]) && [FH] < earlier([FH])),[FH])

Idealmente, debería haber fecha para hacer esto

nandukrishnavs
Super User
Super User

@Zabeer

Prueba esto

Output = 
var _CurrentProduct=NewTable[Product]
var _PreviousFH= MAXX(FILTER(NewTable,NewTable[FH]<EARLIER(NewTable[FH]) && NewTable[Product]=_CurrentProduct),NewTable[FH])
var _result=NewTable[FH]-_PreviousFH
return IF(ISBLANK(_PreviousFH),0,_result)

Capture.JPG



¿Respondí a tu pregunta? ¡Marca mi puesto como solución!
Apreciar con un kudos
🙂


Regards,
Nandu Krishna

az38
Community Champion
Community Champion

Hola @Zabeer

probar una columna

Expected Outcome = 
var _prevVal = CALCULATE(MAX('Table'[FH]),FILTER('Table','Table'[Product]=EARLIER('Table'[Product]) && 'Table'[FH] < EARLIER('Table'[FH])))
RETURN
IF(ISBLANK(_prevVal), 0, _prevVal)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

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.