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
francoisl
Helper I
Helper I

Ventas de 'Bucketing' en la matriz de precios.

Hola a todos

Necesito hacer ventas en una matriz de precios. La matriz de precios tiene descuentos en la unidad vendida. Actualmente estoy ignorando la fecha, las tablas de productos en aras de la claridad, pero si las necesitamos, no dude en añadirlas en la explicación.

Este es un ejemplo sencillo.

Tabla de cuadrícula de precios con rotura (tabla importada)

ProductoNivelDeParaPRECIO UNITARIO
A101010.00
A211208.50
A3219999997.75
B101545.00
B21699999937.00
D1099999925.00

Tabla de ventas con cantidad ordenada (tabla importada)

FacturaProductoQtyPRECIO UNITARIO
1A310.00
2D4525.00
3C312.00
4A158.50
5A178.50
6B745.00
7B945.00

Resultados deseados

ProductoNivelDeParaPRECIO UNITARIOQTYSOLD
A101010.003
A211208.5032
A3219999997.750
B101545.0016
B21699999937.000
D1099999925.0045

Mi reto aquí es que no quiero usar el precio porque siempre hay una buena razón de negocio para cambiar el precio de un pedido. La cantidad debe ser el controlador para cubo esas ventas. Por supuesto, el nivel no está en la tabla de ventas... que habría sido fácil.

El producto C no está en la cuadrícula de precios y no debe aparecer en el resultado deseado. Si no se vendió nada, entonces tenemos que mostrar 0.

999999 es siempre el valor superior del último nivel, incluso si sólo hay un nivel.

Estoy luchando con el valor de búsqueda o el primer en blanco en la mesa de ventas, pero no creo que esta sea la manera correcta de hacer esto. Voy a intentar el comando dax relacionado, pero actualmente cualquier comentario es bienvenido.

Muchas gracias


François

1 ACCEPTED SOLUTION

Hola @francoisl ,

Puede actualizar la medida "QTYSOLD " como se muestra a continuación:

QTYSOLD ?
CALCULAR (
SUM ( 'Ventas'[QTY] ),
FILTRO (
'Ventas',
'Ventas'[PRODUCTO] á MAX ( 'Precio'[Producto] )
&& 'Ventas'[CANTIDAD]>'MAX('Precio'[FROM])
&&'Ventas'[CANTIDAD]<-MAX('Precio'[A])
)
) + 0

Saludos

Rena

Community Support Team _ Rena
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

5 REPLIES 5
v-yiruan-msft
Community Support
Community Support

Hola @francoisl ,

Puede crear dos medidas como se indica a continuación:

QTYSOLD = 
CALCULATE (
    SUM ( 'Sales'[QTY] ),
    FILTER (
        'Sales',
        'Sales'[PRODUCT] = MAX ( 'Price'[Product] )
            && 'Sales'[UNIT PRICE] = MAX ( 'Price'[UNIT PRICE] )
    )
) + 0
Measure = 
SUMX (
    VALUES ( 'Price'[Product] ),
    SUMX ( VALUES ( 'Price'[Level] ), [QTYSOLD] )
)

'Bucketing' sales in price matrix.JPG

Saludos

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hola a todos

Estaba buscando específicamente una solución que utiliza un intervalo y no el precio.

Gracias voy a seguir buscando una solución específica.

F

Hola @francoisl ,

Puede actualizar la medida "QTYSOLD " como se muestra a continuación:

QTYSOLD ?
CALCULAR (
SUM ( 'Ventas'[QTY] ),
FILTRO (
'Ventas',
'Ventas'[PRODUCTO] á MAX ( 'Precio'[Producto] )
&& 'Ventas'[CANTIDAD]>'MAX('Precio'[FROM])
&&'Ventas'[CANTIDAD]<-MAX('Precio'[A])
)
) + 0

Saludos

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Parece que las soluciones anteriores están bastante cerca.

Agregue una columna a la tabla PriceGrid como esta:

ColQTYSOLD = CALCULATE(SUM(SalesTable[QTY]), FILTER(SalesTable, SalesTable[PRODUCT] = PriceGrid[PRODUCT]  && SalesTable[QTY]  >= PriceGrid[FROM] && SalesTable[QTY] <= PriceGrid[TO])) + 0

amitchandak
Super User
Super User

@francoisl, puede obtener una nueva columna en la tabla de cuadrícula de precios como

QTYSOLD á sumx(filter(Sales,sales[PRODUCT]-PriceGrid[PRODUCT] &&sales[UNIT PRICE]-PriceGrid[UNIT PRICE] ), sales[QTY])

También puede utilizar ventas[PRECIO UNITARIO]>-PriceGrid[from] from && sales[UNIT PRICE]< ?PriceGrid[to] en lugar de ventas[PRECIO DE UNIDAD]-PriceGrid[PRECIO DE UNIDAD]

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.