Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
jorditorras
Creator
Creator

Agrr Calculation

Dear Gurus, 

I have an scenario where one record (Node_ID) can have different Levels of Hierarchy. Then we have a KPI of Number of Hours for each one. In the example below, I want to calculate the number of Hours only in Level 3. For that I use an Aggr as 

Sum(Aggr(Sum([Hours]),[Level 3])

But it's summing the TOTAL of Hours (as if I was calculating the Total for Level 2: 

jorditorras_0-1651664733490.png

The result that I expect is 45.837 and not 190.207...

Any idea how to calculate this??

Thanks!!

Labels (1)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

It is returning the correct output given your data

there are two possible values in level 3

1) Area1

2)'-'   

 

If you only want to calculate level3 where field is not '-' or null then change expression to below,

sum({<Nodes_Id={"=len(Level3)>1"}>}Hours)  <<-- returns sum hours at level3 where level3 is not empty

Also since level3 is your last level, you don't need sum(Aggr(

 

 

Any other Level which is not the last level you can be calculated using the TOTAL keyword as below

For level2

sum({<Nodes_Id={"=len(Level3)>1"}>} TOTAL <Level2> Hours) <<-- returns sum hours at level2 where level3 is not empty

for Level1

sum({<Nodes_Id={"=len(Level3)>1"}>} TOTAL <Level1> Hours) 

<<-- returns sum hours at level1 where level3 is not empty

 

if you need to check if the corresponding level is not empty then change the set analysis  as below

sum({<Nodes_Id={"=len(Level2)>1"}>} TOTAL <Level2> Hours)   <<-- returns sum hours where level2 is not empty

 

 

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

1 Reply
vinieme12
Champion III
Champion III

It is returning the correct output given your data

there are two possible values in level 3

1) Area1

2)'-'   

 

If you only want to calculate level3 where field is not '-' or null then change expression to below,

sum({<Nodes_Id={"=len(Level3)>1"}>}Hours)  <<-- returns sum hours at level3 where level3 is not empty

Also since level3 is your last level, you don't need sum(Aggr(

 

 

Any other Level which is not the last level you can be calculated using the TOTAL keyword as below

For level2

sum({<Nodes_Id={"=len(Level3)>1"}>} TOTAL <Level2> Hours) <<-- returns sum hours at level2 where level3 is not empty

for Level1

sum({<Nodes_Id={"=len(Level3)>1"}>} TOTAL <Level1> Hours) 

<<-- returns sum hours at level1 where level3 is not empty

 

if you need to check if the corresponding level is not empty then change the set analysis  as below

sum({<Nodes_Id={"=len(Level2)>1"}>} TOTAL <Level2> Hours)   <<-- returns sum hours where level2 is not empty

 

 

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.