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
Manuu_108
Frequent Visitor

Actualización del Precio de Venta

Buenas tardes, de antemano agradecerlos por la ayuda, tengo una tabla de (precios de producto) que va cambiando constantemente, lo que necesito es traer los precios actualizados a la tabla de ventas para poder sumar y obtener el total, o hay otra forma mas sencilla de poder obtener el total de ventas?
vtas.jpg

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @Manuu_108 ,

Here are the steps you can follow:

1. In Power query. Add Column Index Column From 1 (Add for Ventas table)

vyangliumsft_0-1653319009847.png

2. Create measure.

measure_Precio Unitario =
var _max=CALCULATE(MAX('Table de Precio'[FechaPrecio]),FILTER(ALL('Table de Precio'),'Table de Precio'[SKU]=MAX('Ventas'[SKU])&&'Table de Precio'[FechaPrecio]<=MAX('Ventas'[Fecha Venta])))
return
CALCULATE(SUM('Table de Precio'[Precio Unitario]),FILTER(ALL('Table de Precio'),'Table de Precio'[SKU]=MAX('Ventas'[SKU])&&'Table de Precio'[FechaPrecio]=_max))
Flag =
[measure_Precio Unitario] * MAX('Ventas'[Pedido])
Total Ventas =
var _table=SUMMARIZE('Ventas','Ventas'[Index],"_value",[Flag])
return
IF(HASONEVALUE('Ventas'[Index]),[Flag],SUMX(_table,[_value]))

3. Result:

vyangliumsft_1-1653319009850.png

If you need pbix, please click here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @Manuu_108 ,

Here are the steps you can follow:

1. In Power query. Add Column Index Column From 1 (Add for Ventas table)

vyangliumsft_0-1653319009847.png

2. Create measure.

measure_Precio Unitario =
var _max=CALCULATE(MAX('Table de Precio'[FechaPrecio]),FILTER(ALL('Table de Precio'),'Table de Precio'[SKU]=MAX('Ventas'[SKU])&&'Table de Precio'[FechaPrecio]<=MAX('Ventas'[Fecha Venta])))
return
CALCULATE(SUM('Table de Precio'[Precio Unitario]),FILTER(ALL('Table de Precio'),'Table de Precio'[SKU]=MAX('Ventas'[SKU])&&'Table de Precio'[FechaPrecio]=_max))
Flag =
[measure_Precio Unitario] * MAX('Ventas'[Pedido])
Total Ventas =
var _table=SUMMARIZE('Ventas','Ventas'[Index],"_value",[Flag])
return
IF(HASONEVALUE('Ventas'[Index]),[Flag],SUMX(_table,[_value]))

3. Result:

vyangliumsft_1-1653319009850.png

If you need pbix, please click here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

PaulDBrown
Community Champion
Community Champion

Puedes por favor publicar la información en formato datos en lugar de imágenes?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






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.