Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Cascader
Creator
Creator

Average of Aggr result not showing the correct result

hi 

I have the following expression that I implement aggregation function on result of Aggr

    Avg(
        Aggr(           
            AVG({<MC.isLastWorkDay={'1'},Team={'A'}>} IF(OnTarget >= Target, 10)),
             ProductGroup
        )
    );
 
 the following example:
 
ProductGroup              OnTarget
------------------------------------------------
P1                                              1
P2                                              1
P3                                              0
 
I supposed to get .67 but I'm getting other result 
 
Labels (2)
1 Solution

Accepted Solutions
stevejoyce
Specialist II
Specialist II

so this below would be the equivalent of what your table shows:
 
 
Avg({<MC.isLastWorkDay={'1'},Team={'A'}>}
        Aggr(           
            If(AVG({<MC.isLastWorkDay={'1'},Team={'A'}>} OnTarget) >= Target, 10),
             ProductGroup
        )
    );

View solution in original post

5 Replies
stevejoyce
Specialist II
Specialist II

Try below update:
 
Avg({<MC.isLastWorkDay={'1'},Team={'A'}>}
        Aggr(           
            AVG({<MC.isLastWorkDay={'1'},Team={'A'}>} IF(OnTarget >= Target, 10)),
             ProductGroup
        )
    );
Cascader
Creator
Creator
Author

still return the same result!

stevejoyce
Specialist II
Specialist II

Ok, can you post sample data and/or screenshot?

I guess if i were to do the calculation I would do this, you can try...

=Count({<MC.isLastWorkDay={'1'},Team={'A'}, ProductGroup = {"=OnTarget>=Target"}>} ProductGroup)

/

Count({<MC.isLastWorkDay={'1'},Team={'A'}>} ProductGroup)

Cascader
Creator
Creator
Author

Ahmedg_0-1632926206074.png

this is the data, I'm supposed to get 0.8 as result but i'm getting 0.4375

stevejoyce
Specialist II
Specialist II

so this below would be the equivalent of what your table shows:
 
 
Avg({<MC.isLastWorkDay={'1'},Team={'A'}>}
        Aggr(           
            If(AVG({<MC.isLastWorkDay={'1'},Team={'A'}>} OnTarget) >= Target, 10),
             ProductGroup
        )
    );