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
dragonus
Helper III
Helper III

Encontrar la diferencia para una mesa larga

Estoy tratando de crear una medida para encontrar la diferencia entre 2 categorías diferentes en la misma tabla larga... Intenté sum(ValueA) - sum(ValueB), pero no funciona

Tabla de muestras:

FechaCategoríaValor
1/1/19A29
1/1/19B23
2/1/19A35
2/1/19B123
3/1/19A4
3/1/19B2123
4/1/19A445
4/1/19B32

Así que la medida debería ser capaz de tener A - B para todas las fechas, por lo que para 1/1/19, debería darme 7 (29 - 23)

2 REPLIES 2
v-eachen-msft
Community Support
Community Support

Hola @dragonus ,

Puede crear una nueva columna para obtener valores negativos.

Column =
IF ( 'Table'[Category] = "A", 'Table'[Value], - 'Table'[Value] )

A continuación, cree una medida:

Measure =
CALCULATE ( SUM ( 'Table'[Column] ), ALLEXCEPT ( 'Table', 'Table'[Date] ) )

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

@dragonus ,

measure ? calculate(sum(Table[Value]), Table[Category]-"A") - calculate(sum(Table[Value]), Table[Category]-"B")

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.