The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
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
User | Count |
---|---|
15 | |
12 | |
8 | |
7 | |
7 |
User | Count |
---|---|
24 | |
21 | |
12 | |
10 | |
7 |