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

Predecir el futuro inventary

Hola.

Estoy creando tabla de inventario mezclando datos reales para los últimos días y datos predichos para los días futuros. Tengo estas 3 tablas:

https://docs.google.com/spreadsheets/d/1NHSx1a4oN7X3hYK39o39RcaKuhZjYkLkh2OtDvnKx3o/edit#gid=0

Las fórmulas de columna de tabla de inventario son:

S0 - IF(inventario[fecha]<TODAY(), PastInventory [S0],CALCULATE(MIN(inventory[S_final]), ALLEXCEPT(inventario, inventario[sku]), PREVIOUSDAY(inventory[date])))
Ingresos : IF(inventario[fecha]<TODAY(), PastInventory [Ingresos],LOOKUPVALUE('Incomes'[quantity_in], 'Incomes'[producto], inventario[producto], 'Incomes'[date_in], inventario[fecha])
Resultados: IF(inventory[date]<TODAY(), PastInventory [Outcomes],
LOOKUPVALUE(PastInventory [Maxlast3dOutcomes], PastInventory [producto], inventario[producto]))
Sf - Así + Ingresos - Resultados
Mi problema viene con la fórmula Sf a medida que caigo en un error de dependencia circular como columna Sf se ve afectada por "Así" y "Así" se basa en la columna Sf del último día. Sin embargo, ninguna fila tiene dependencia circular porque "So" obtiene datos de fila Sf anteriores y Sf está tomando los mismos datos de fila.
Como puede ver, pude crear una tabla INVENTORY con Excel sin ningún error de dependencia porque Excel funciona con el nivel de fila y Power BI con error de columna. No sé cómo puedo evitar esta función circular de Power BI.
¿Alguien puede ayudarme, por favor?
Gracias de antemano.
4 REPLIES 4
v-lili6-msft
Community Support
Community Support

hola @aramirez2

El archivo que cargó necesita permiso, por favor cargue de nuevo.

y también podrías echar un vistazo a este blog:

https://www.sqlbi.com/articles/avoiding-circular-dependency-errors-in-dax/

saludos

Lin

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

@v-lili6-msft Lo siento, olvidé abrir la hoja de cálculo. Sin embargo, ya he encontrado la solución

Sf = VAR Sf = LOOKUPVALUE(PASTINVENTORY[Sf], PASTINVENTORY[Date], MAX(PASTINVENTORY[Date]), PASTINVENTORY[Product], inventory[productId]) 
var curdate = inventory[date] 
var lastdate1 = MAX(PASTINVENTORY[Date]) 
var io = CALCULATE(SUM(inventory[income])-SUM(inventory[outcome]),FILTER(ALL(inventory),AND(inventory[date] <= curdate,inventory[date] >= lastdate1))) 
var a = IF(inventory[date]<TODAY(), LOOKUPVALUE(PASTINVENTORY[Sf], PASTINVENTORY[Date], inventory[date], PASTINVENTORY[Product], inventory[productId]), Sf+io) 
RETURN a

Greg_Deckler
Super User
Super User

@aramirez2 - Tal vez eche un vistazo a Días de Suministro - https://community.powerbi.com/t5/Quick-Measures-Gallery/Days-of-Supply/m-p/635656#M318


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Gracias @Greg_Deckler por tu respuesta. Es un gran ejercicio a pesar de que no está muy relacionado con mi problema.

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.