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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
manuelacardonan
Frequent Visitor

Comprar unidades a producir con capacidad disponible

Hola a todos, estoy necesitando ayuda:

 

a) Tengo una matriz, que muestra el numero de unids a producir por mes (es una consulta query interna) de la base de datos de la compañia, esta base de datos se esta actualizando todo el tiempo.

 

manuelacardonan_0-1687714976034.png

 

b) tenemos unas capacidades fijas de producción que varian de acuerdo al mes en un arhivo de excel:

manuelacardonan_1-1687714976482.png

 

¿Como puedo relacionar en la matriz estas capacidades para ir visualización el % de ocupación de la capacidad?

 El resultado final que deseo obtener es poder ver que por ejemplo en el mes de enero solo he ocupado el 41% de la capacidad:

 

Unids a producir (167k) / capacidad enero (398k)

 

Muchas gracias a todos por su ayuda

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @manuelacardonan ,

I created some data:

vyangliumsft_0-1687941077727.png

 

Here are the steps you can follow:

1. Create calculated column.

Flag =
var _ca=
SUMX(
    FILTER(ALL(Table2),
    'Table2'[mes_corte]=EARLIER('Table1'[mes_corte])),[cap_mensual])
var _va=
SUMX(
    FILTER(ALL('Table1'),
    'Table1'[mes_corte]=EARLIER('Table1'[mes_corte])),[Value])
return
DIVIDE(
    _va,_ca)

2. Create calculated table.

True =
var _table1=
SUMMARIZE(
    'Table1','Table1'[mes_corte],'Table1'[marca],Table1[Value])
var _table2=
SUMMARIZE(
    'Table1',
    'Table1'[mes_corte],
    "marca","cap",
    "Value",SUMX(FILTER(ALL('Table1'),'Table1'[mes_corte]=EARLIER('Table1'[mes_corte])),[Flag])/CALCULATE(DISTINCTCOUNT('Table1'[marca])))
return
UNION(
    _table1,_table2)

3. Result:

vyangliumsft_1-1687941077733.png

 

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

1 REPLY 1
v-yangliu-msft
Community Support
Community Support

Hi  @manuelacardonan ,

I created some data:

vyangliumsft_0-1687941077727.png

 

Here are the steps you can follow:

1. Create calculated column.

Flag =
var _ca=
SUMX(
    FILTER(ALL(Table2),
    'Table2'[mes_corte]=EARLIER('Table1'[mes_corte])),[cap_mensual])
var _va=
SUMX(
    FILTER(ALL('Table1'),
    'Table1'[mes_corte]=EARLIER('Table1'[mes_corte])),[Value])
return
DIVIDE(
    _va,_ca)

2. Create calculated table.

True =
var _table1=
SUMMARIZE(
    'Table1','Table1'[mes_corte],'Table1'[marca],Table1[Value])
var _table2=
SUMMARIZE(
    'Table1',
    'Table1'[mes_corte],
    "marca","cap",
    "Value",SUMX(FILTER(ALL('Table1'),'Table1'[mes_corte]=EARLIER('Table1'[mes_corte])),[Flag])/CALCULATE(DISTINCTCOUNT('Table1'[marca])))
return
UNION(
    _table1,_table2)

3. Result:

vyangliumsft_1-1687941077733.png

 

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

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.