Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
dunnalahk123
Creator III
Creator III

AGGR in QLikview Script

Hi,

Duplicates.PNG

I have one Parent id to that Actual value is 3 but same parent ID has 3 Subtasks  so when i wrote Sum(Actual) i am getting 10 but problem is Sum (Parent Actual ) i should get only 3 as it has same project iD  so my Total should be 10+3 =13.

but right now i am getting 10+9=19 which is wrong .

So how can i write it in back end Qlikview Script.

1 Solution

Accepted Solutions
sunny_talwar

Or this

Sum(Aggr(Sum(DISTINCT [Parent Actual]), [Parent]))

 

View solution in original post

13 Replies
sunny_talwar

What exactly are you looking to do in the script? You want to do the Sum() in the script? 

dunnalahk123
Creator III
Creator III
Author

Hi Sunny,

Yes ,  Basically in the example i have given 1 parent value is getting repeated for 3 times as it has 3 child.

My Numerator is Sum(Parent Actual) >>> right now i am getting 3+3+3=9  but i should get once per Parent. so i should get 3 as my numerator as Parent is same . (Basically it should sum only once per Parent)

Sum(Parent Actual) as Numerator----It should come only once per Parent ( this how can i write in back end script ?)
Sum(Actual) as Denominator -- no problem as i am summing at child level it comes correctly.

tresesco
MVP
MVP

May be like:

 Sum(Distinct [Parent Actual])

 

sunny_talwar

Or this

Sum(Aggr(Sum(DISTINCT [Parent Actual]), [Parent]))

 

dunnalahk123
Creator III
Creator III
Author

Hi Sunny,

 

can i give it in back end script ? i tried in back end script but its not taking it .

dunnalahk123
Creator III
Creator III
Author

 Hi,

 

I tried in back end script  but it failed saying invalid expression.

sunny_talwar

You want to pre-aggregate the data in the script? Is that what you are trying to do?

dunnalahk123
Creator III
Creator III
Author

Hi Sunny,

 

Yes, when pull to front end it should be just sum(numerator ) / sum(denominator) everything should be derived at back end script itself.

dunnalahk123
Creator III
Creator III
Author

 Hi Sunny,

 

Please let me know if i am not clear.

Best Regards,

HK