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
Renan_Barrios
New Member

Como preencher os valores vazios com a informação da quantidade anterior em coluna calcula - Estoque

Bom dia,

Estou fazendo um visual para mostrar o histórico de estoque mês a mês, com isso preciso ter o a quantidade do estoque todo mês, porém tem mês que nem todos os itens do estoque movimentam no sistema porém preciso dessa informação para saber o total.
Preciso preencher o vazio do estoque pelo estoque anterior do item assim como está na foto.

Renan_Barrios_0-1673990832520.png

preciso preencher esses valores de "0" com a informação do estoque anterior linha a linha.

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

Hi @Renan_Barrios ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1674008917346.png

Please try:

Column = 
var _a = MAXX(FILTER('Table',[ID]=EARLIER('Table'[ID])&&[Value]<>0&&[YearMonth]<EARLIER('Table'[YearMonth])),[YearMonth])
var _b = CALCULATE(MAX('Table'[Value]),FILTER('Table',[ID]=EARLIER('Table'[ID])&&[YearMonth]=_a))
return IF([Value]=0,_b,[Value])

Final output:

vjianbolimsft_1-1674008951944.png

Best Regards,

Jianbo Li

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

3 REPLIES 3
Renan_Barrios
New Member

Renan_Barrios_0-1674059384344.png

Ele deu certo quando o item não movimenta por um mês, porém tem itens que não movimentam por mais tempo ai preciso preencher também

 

v-jianboli-msft
Community Support
Community Support

Hi @Renan_Barrios ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1674008917346.png

Please try:

Column = 
var _a = MAXX(FILTER('Table',[ID]=EARLIER('Table'[ID])&&[Value]<>0&&[YearMonth]<EARLIER('Table'[YearMonth])),[YearMonth])
var _b = CALCULATE(MAX('Table'[Value]),FILTER('Table',[ID]=EARLIER('Table'[ID])&&[YearMonth]=_a))
return IF([Value]=0,_b,[Value])

Final output:

vjianbolimsft_1-1674008951944.png

Best Regards,

Jianbo Li

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

Deu certo, a coluna [Filial] era um filtro também então concatenei o part number e a filial para criar um novo ID, desta forma deu certo.

Renan_Barrios_0-1674061865000.png

 

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.