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

Calculating changes when choosing two different dates

Hi

I have a daily stock. The stock value is broken down to dimension material.

I would like to choose two different dates and the show the difference in stock.

It is working so far but when I have stock and the total stock is being delivered so the new stock is 0 then I am getting a "-" and no changes "-" and I need the stock so show 0 and the changes -XX.

What I have (red):

JoannaM_0-1640091107795.png

What I need (green):

JoannaM_1-1640091172008.png

 

Set analysis:

 

sum(aggr(Sum([pob development quantity])

-

above(sum([pob development quantity]),1),material,[POB date]))

 

Thanks for the help.

Best regards,

Joanna

 

1 Solution

Accepted Solutions
Or
MVP
MVP

Then the issue is probably the latter option I mentioned, where there is no row in the data for the combination 3005011 / 20.12.2021 and as a result the aggr() can't be calculated. Assuming the aggr() is required to behave as is, you could try stuffing the data with 0 values for any missing combinations - depending on the data structure this may or may not be feasible.

View solution in original post

4 Replies
Or
MVP
MVP

You could try using:

sum(aggr(RangeSum(Sum([pob development quantity])

,

above(sum([pob development quantity]),1)),material,[POB date]))

Which would prevent null results when the Above() section is a null. However, this won't solve the problem if the issue is that there is no row for this material / POB date combination, because those are your aggr() fields.

JoannaM
Contributor III
Contributor III
Author

Thanks for the input. I tried with Rangesum but unfortunately, it is not working either. Neither does Alt(X,0). Neither does isnull() nor if(isnull()).

Or
MVP
MVP

Then the issue is probably the latter option I mentioned, where there is no row in the data for the combination 3005011 / 20.12.2021 and as a result the aggr() can't be calculated. Assuming the aggr() is required to behave as is, you could try stuffing the data with 0 values for any missing combinations - depending on the data structure this may or may not be feasible.

JoannaM
Contributor III
Contributor III
Author

Thanks for your help. It looks like this is the issue. I will try to fill the missing data with 0. BR, Joanna