cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Alejandro9805
New Member

Calcular cobertura de inventario

 

Buen día,

 

Necesito ayuda, estoy intentando calcular la cobertura de inventario dado una clasificación, pero esta no me permite:

 

Código DAX:

 

Cobertura por estilo = CALCULATE(DIVIDE([Cantidad disponible],[Promedio de venta],
FILTER('Inventario sin ubicación','Inventario sin ubicación'[ESTILO] = "Accesorios","Llantas y Neumaticos","Baterias","Bombillos")))
 
Sale un error el cuál es:
 
La expresión hace referencia a varias columnas. No se pueden convertir varias columnas a un valor escalar.
 
Cuando saco cobertura a nivel de ítem, me da el valor correcto, falla cuando quiera hacerlo dado una agrupación.
 
Espero me puedan ayudar.
 
Gracias!
1 ACCEPTED SOLUTION

Hi @Alejandro9805 ,

 

On my test, The measure seems no problem:

vyadongfmsft_0-1670229867199.png

 

In order to better understanding your demands and give the right solution, could you please share with me some screenshots of your data after hiding sensitive information and tell me what's your expected output?

 

Thanks for your efforts & time in advance.

 

Best regards,

Yadong Fang

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

4 REPLIES 4
amitchandak
Super User
Super User

@Alejandro9805 , try like

 

Coverage by Style = CALCULATE(DIVIDE([Available Quantity],[Average Sales],
FILTER('Inventory without location','Inventory without location'[STYLE] in {"Accessories","Wheels and Tires","Batteries","Light Bulbs"})))



Learn Power BI - Full Course with Dec-2022, with new DAX functions like Window, Index, Offset !!
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Formatted Profit and Loss Statement with empty lines

Sorry for the last comment

I noticed the error about the "in" by not closing the {}, when I close it I get this new error.

DAX code:

Coverage by style = CALCULATE(DIVIDE([Quantity on hand],[Average sales],
FILTER('Inventory without location','Inventory without location'[STYLE] in {"Accessories", "Batteries", "Bulbs", "Spark Plugs", "Chains & Links", "Helmets & Helmet Rptos", "Tires & Tires", "Lubricants", "Tires", "Complementary Products", "Original Spare Parts", "Bearings","(blank)"}))))

Error:

The expression refers to multiple columns. It is not possible to convert several columns to a scalar value.

 

Thanks for your help

Hi @Alejandro9805 ,

 

On my test, The measure seems no problem:

vyadongfmsft_0-1670229867199.png

 

In order to better understanding your demands and give the right solution, could you please share with me some screenshots of your data after hiding sensitive information and tell me what's your expected output?

 

Thanks for your efforts & time in advance.

 

Best regards,

Yadong Fang

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

Gracias por ayudar,

Hice lo que me relacionaste, pero ahora me aparece este problema:

Código DAX:

 

Cobertura por estilo = CALCULATE(DIVIDE([Cantidad disponible],[Promedio de venta],
FILTER('Inventario sin ubicación','Inventario sin ubicación'[ESTILO] in {"Accesorios","Baterias","Bombillos","Bujias","Cadenas Y Links","Cascos Y Rptos Cascos","Llantas Y Neumaticos","Lubricantes","Neumaticos","Productos Complementarios","Repuestos Originales","Rodamientos","(en blanco)")))


Error:

La sintaxis de ")" no es correcta. (DAX(CALCULATE(DIVIDE([Cantidad disponible],[Promedio de venta],FILTER('Inventario sin ubicación','Inventario sin ubicación'[ESTILO] in {"Accesorios","Baterias","Bombillos","Bujias","Cadenas Y Links","Cascos Y Rptos Cascos","Llantas Y Neumaticos","Lubricantes","Neumaticos","Productos Complementarios","Repuestos Originales","Rodamientos","(en blanco)"))))).

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

Thank you 2022 Review

2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.