Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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 :
Thanks in advance
@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
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group