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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
reynaldo_malave
Helper III
Helper III

Sumx column total

Hi Guys, 

 

I am trying to move a calculation from a sql query to dax. I am able to calculate the number on a row level but i cannot get a total from it.
Here is my Dax: 

Costo Oportunidad = 

var precioventa =

    LOOKUPVALUE(
        Productos[Precio Venta],
        Productos[Código Producto],
        SELECTEDVALUE(
            Desabasto[Producto]
        )
    )

var ventateorica7dias =

    SUMX(
        Desabasto,
        (DIVIDE(
            CALCULATE( SUM( Desabasto[Vtas30Días] ) ),
            30
        ) - Desabasto[Existencias]) * precioventa      
    )

return 

    ventateorica7dias

 

Notice how the left column has a total and the right does not :

 

reynaldo_malave_0-1625601150994.png

 

Thanks in advance

2 REPLIES 2
Fowmy
Super User
Super User

@reynaldo_malave 

Can you try this modified version?

Costo Oportunidad =
VAR ventateorica7dias =
    SUMX (
        Desabasto,
        ( DIVIDE ( SUM ( Desabasto[Vtas30Días] ), 30 ) - Desabasto[Existencias] )
            * LOOKUPVALUE (
                Productos[Precio Venta],
                Productos[Código Producto], Desabasto[Producto]
            )
    )
RETURN
    ventateorica7dias
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

HI @Fowmy ,

Thanks for your answer, although new version aggregates shows a wrong total.

reynaldo_malave_0-1625603812341.png

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.