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

Expression to show only aggregated 0 values

Hi All,

Here is my current expression which works as needed. However, I am wondering if there is a more efficient way to do this.

If (Aggr(Sum({<[Stock]={'In stock','out-stock'}>}[Allocated ]),[Material],[Plant ]) = 0
and Aggr(Sum({<[Stock]={'In stock','out-stock'},>}[Surplus ]),[Material ],[Plant ]) <> 0,
Aggr(Sum({<[Stock]={'In stock','out-stock'}>}[Direct Cost]),[Material ],[Plant]))

I only want to see the sum of direct cost for the aggregated material plant combination if the Sum of Allocated Qty is 0 and the sum of surplus Qty is <> 0 for the aggregated material plant combination for Stock & out-Stock.  In the example data I should only see a single line for material ABC-044-651 and direct cost of 17

Thanks for the help

MaterialPlantStockDirect CostAllocatedSurplus
XXX-015-7633999stock000
XXX-015-7633999stock4013
XXX-015-7633999stock7025
XXX-015-7633999stock8026
XXX-015-7633999out-stck91025
ABC-044-6513003out-stck000
ABC-044-6513003out-stck501
ABC-044-6513003out-stck1001
ABC-044-6513003stock203
123-044-6523980stock904
123-044-6523980stock230
1 Solution

Accepted Solutions
JonnyPoole
Employee
Employee

you can avoid the aggr() if using the expression in a chart with both Plant and Material as dimensions:

if(

  sum( total <Plant,Material> Allocated) = 0

  and

  sum( total <Plant,Material> Surplus) <> 0,

  sum(total <Plant,Material> [Direct Cost])

)

Capture.PNG.png

View solution in original post

2 Replies
JonnyPoole
Employee
Employee

you can avoid the aggr() if using the expression in a chart with both Plant and Material as dimensions:

if(

  sum( total <Plant,Material> Allocated) = 0

  and

  sum( total <Plant,Material> Surplus) <> 0,

  sum(total <Plant,Material> [Direct Cost])

)

Capture.PNG.png

regowins
Creator II
Creator II
Author

Great Thanks!  I knew there was another way of doing this. Unfortunately, I have a small discrepancy between the two expressions and need to figure out which is more accurate  .