Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Cumulative stock repeating values on days with no movement

Hi guys,

I ask for your support to guide me with the following problem:

I have a table of materials with their stocks, to calculate them they must be cumulative (and this works correctly), but now the problem occurs when I am asked to keep the stock on the days when there has been no movement. Here is an example:

Current scenario:

Stock actual.PNG

Desired scenario:

Stock Ideal.PNG

As we can see on January 1, 2016 there were movements, and then there was another on January 5, but on days 2, 3 and 4 there were no movements so the stock is what happened on January 1, and So on the days in which there was no movement should be placed the stock of the last day of movement, to thereby be able to perform the average of the day, as shown in the 2nd image.

Thank you in advance for your support.

Greetings.

22 Replies
sunny_talwar

May be this

=Sum({<Fe.contabilización = {"$(='>=' & Date(MonthStart(Max(Fe.contabilización), -11), 'DD/MM/YYYY') & '<' & Date(MonthStart(Max(Fe.contabilización), 1), 'DD/MM/YYYY'))"}, Año,Mes, Year, Month>}

Aggr(fabs(sum({<[Clase de movimiento]={'201','221','261'}>}[Ctd.en UM entrada]))/(Sum({1<Fe.contabilización = {"$(='>=' & Min(Fe.contabilización))"}>} Aggr(RangeSum(Above(Sum({<Año,Mes, Year, Month>}[Ctd.en UM entrada]) + Avg({1} 0), 0, RowNo())),(Fe.contabilización,(NUMERIC,ASCENDING))))

/ Day(Max({1<Year = p(Year)>}Fe.contabilización))), Year, Month))/12

Anonymous
Not applicable
Author

This is correct but when I try to group by material does not leave the indicated value in the text object, I tried to add it to aggr but I can not find the result.

When I select a material:

parte 1.PNG

When I do not select any material:

parte 2.PNG

What would be the expression for that table?

Thank you very much friend.

Regards.

sunny_talwar

That goes into the territory of much more complex problem... I don't have the time to work on this right now... but if no body offers help, I will try to revisit this over the weekend