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
Anonymous
Not applicable

SUMX con valores duplicados

Hola a todos

He creado una fórmula SUMX según abajo que trae de vuelta los valores en una columna que son menos:

MENOS - SUMX (
( VALORES ( TotalData[ Cost] )),
IF ( TotalData[ Cost] < 0, TotalData[ Cost], BLANK () )
)
Sin embargo, si hay valores duplicados en la columna no los cuenta, por ejemplo, tengo un filtro que tiene los siguientes valores:
-102.8933
-74.8
-76.02
-85.566
-85.566
-27.88
-35.52
Obviamente eso debe traer de vuelta -488.2453 sin embargo, trae de vuelta -402.6793 porque está eliminando uno de los -85.566 registros.
¿Alguna idea?
Gracias
Marca

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hola @mjohnsonvertu

no necesitavalores aquí.

sólo nombre de la tabla o ALL()

MINUS = SUMX (
    TotalData,
    IF ( TotalData[       Cost] < 0, TotalData[       Cost], BLANK () )
)

O

MINUS = SUMX (
    ALL(TotalData),
    IF ( TotalData[       Cost] < 0, TotalData[       Cost], BLANK () )
)


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

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

VALUES solo devuelve valores distintos. No sé por qué estás usando VALUES allí, parece ser desenfrenado que la gente arroje VALOR o VALORES en fórmulas cuando no son necesarias. Desearía poder encontrar la fuente de donde viene ese mal hábito. Bueno.

Prueba esto:

MINUS = 
  SUMX (
    FILTER('TotalDate',[       Cost] < 0),
    [       Cost]
  )

Añadido bono, debe ser mucho más performante.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
az38
Community Champion
Community Champion

Hola @mjohnsonvertu

no necesitavalores aquí.

sólo nombre de la tabla o ALL()

MINUS = SUMX (
    TotalData,
    IF ( TotalData[       Cost] < 0, TotalData[       Cost], BLANK () )
)

O

MINUS = SUMX (
    ALL(TotalData),
    IF ( TotalData[       Cost] < 0, TotalData[       Cost], BLANK () )
)


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

@az38 ¡Trabaja un placer, gracias!

vijayvizzu
Helper III
Helper III

@mjohnsonvertu : la función VALUES siempre devolverá una lista única de valores, por lo que sería mejor si puede eliminar la función Valores en SUMX

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.

Top Kudoed Authors