Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
128718
Contributor II
Contributor II

How to convert non aggregated function into aggregated function

Hi Expert,

I am having the below expression which is working fine and having right values in KPI,

sum(aggr(max({<[Type]={'S01'},[num]={0}>}[Days]),[ID]))/count([ID])

Now I want to pull this measure into pivot table. Since the nested aggr and island dimension is creating trouble I want the expression changed into non aggregated measure.

sum( distinct {<[ID]={"=max({<[Type]={'S01'},[num]={0}>}Days)"}>}[ID])/count([ID])

While using the above expression it is returning huge value.

Please help me to attain the target.

Thanks in advance

 

 

5 Replies
stevejoyce
Specialist II
Specialist II

What are your pivot table dimensions?  Replace your pivot table dimensions in the aggr parameter where you have ID

sum(aggr(max({<[Type]={'S01'},[num]={0}>}[Days]),[ID]))/count([ID])

128718
Contributor II
Contributor II
Author

Hello, 

I am using the below codes

In load editor:

ListofColumns:
Load * INLINE [
Name
Ram,
Raju,
John,
Mike
];

Dim:
Load * INLINE [
Dim
1
2
3
];

In sheet:

Dimension1:Name

Dimension2:pick(Dim,Country,Product)

Measure:

sum(aggr(max({<[Type]={'S01'},[num]={0}>}[Days]),Dim,Name,ID))/count([ID])

I am getting value only for the first dimension(Name-'Ram',Dim-'Country')

128718_1-1630064654626.png

Please guide me to find the solution 

stevejoyce
Specialist II
Specialist II

What if you make your measure like below.  I don't think you're going to be able to have 1 aggr function using this Dim column like that

pick(Dim,

sum(aggr(max({<[Type]={'S01'},[num]={0}>}[Days]),Name,Country, ID)),

sum(aggr(max({<[Type]={'S01'},[num]={0}>}[Days]),Name,Product, ID))

)

/count([ID])

128718
Contributor II
Contributor II
Author

Thanks for your reply,

Still it is returning Zero values except for "Ram" same as above issue

stevejoyce
Specialist II
Specialist II

Is there definitely data for these other Names for [Type]={'S01'},[num]={0}?  Calculation does look ok to me.

Are you able to send a fuller data set, it was a bit limited what you sent.