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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.