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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.