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
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"})))

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
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.