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

Medir la devolución de totales incorrectos

Estoy tratando de calcular las ventas para una clase de producto en particular. Estoy usando la siguiente medida:

SumSales = SUMX(FILTER(DimProduct,DimProduct[Class]="L"),SUM(FactInternetSales[SalesAmount]))

que me está dando un valor de 3787269361.4703 (que es incorrecto). Sin embargo, probé lo siguiente:

TotalSales = SUM(FactInternetSales[SalesAmount]) 

SumC = SUMX(filter(DimProduct,DimProduct[Class]="L"),[TotalSales]) 

que me está dando un valor de 2133761.2238 (este es el correcto).

¿Puede usted alguien por favor explique por qué el dax anterior no está mostrando el total correcto.

Según mis conocimientos, ambos DAX son iguales.

¿Qué me estoy perdiendo?

Gracias de antemano.

3 REPLIES 3
danextian
Super User
Super User

Hola @trisabiswas ,

En la primera fórmula, lo que sucede es que la cantidad total de ventas de filas en las que Clase - L se múlma por el número de filas de la tabla DimProduct en el que el valor de la columna Clase es L. Por ejemplo, si el valor total esperado es 2133761.2238 y hay 1775 filas con clase L en DimProduct, el total se convierte en 2133761.2238 * 1775

Puede ajustar la agregación en CALCULATE como lo que @amitchandak ha sugerido o, alternativamente, crear una tabla virtual con SUMMARIZE.

SUMC =
SUMX (
    SUMMARIZE (
        DimProduct,
        DimProduct[Class],
        "value", IF ( DimProduct[Class] = "L", SUM ( FactInternetSales[SalesAmount] ) )
    ),
    [value]
)










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
amitchandak
Super User
Super User

@trisabiswas , Puede utilizar calcular

referencia: https://exceleratorbi.com.au/double-calculate-solves-sumx-problem/

SumSales = SUMX(FILTER(DimProduct,DimProduct[Class]="L"),calculate(SUM(FactInternetSales[SalesAmount])))

Anonymous
Not applicable

Gracias por la solución!!

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.