Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
harleen_singh
Creator III
Creator III

Average percentage problem

Hello,

i am calculating my percentage like this in pivot table in one column say "Percentage".

=sum(if(AUTOFILL_FLAG=1,RX_COUNT))/sum(RX_COUNT)

it gives proper percentage.

But in next column i need to display Average percentage i.e. average of Percentage.

i need result like this

Percentage Avg Percentage

14% 13%

12% 13%

13% 13%

I am just putting Avg function to my above formula like this

AVG (sum(if(AUTOFILL_FLAG=1,RX_COUNT))/sum(RX_COUNT))

its displaying blank values noting comes out. Tell me if i am wrong anywhere?

thanks

Lavi


Labels (1)
1 Solution

Accepted Solutions
harleen_singh
Creator III
Creator III
Author

Finally it worked like this

Avg(Aggr(NODISTINCT sum(if(AUTOFILL_FLAG=1,RX_COUNT))/sum(RX_COUNT),RX_REGION_DS))

thanks

Lavi

View solution in original post

5 Replies
Not applicable

hi

tyr like this once..

AVG (Aggr(sum(if(AUTOFILL_FLAG=1,RX_COUNT))/sum(RX_COUNT)))

regards

A'run'

harleen_singh
Creator III
Creator III
Author

Arun,

thanks for suggestion but it didn't worked. Any other code??

thanks

Lavi

harleen_singh
Creator III
Creator III
Author

any other response from anyone?

harleen_singh
Creator III
Creator III
Author

Arun,

well it worked if i used like this

Avg(Aggr(sum(if(AUTOFILL_FLAG=1,RX_COUNT))/sum(RX_COUNT),RX_REGION_DS))

i just needed to put dimension value in Aggr function separated by coma.

But it displays result like this

Percentage Avg Percentage

14% 13%

12%

13%



I want AVG percentage should be repeated as i mentioned in my earlier post

thanks

Lavi

harleen_singh
Creator III
Creator III
Author

Finally it worked like this

Avg(Aggr(NODISTINCT sum(if(AUTOFILL_FLAG=1,RX_COUNT))/sum(RX_COUNT),RX_REGION_DS))

thanks

Lavi