Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
janardhan
Creator
Creator

Average of Distribution percentage

Hi All,

I have calculated Distribution Percentage and i need avg of distribution percentage. i tried to calculate but the values are not matching.

(line_srvc_cnt/sum(total line_srvc_cnt)*100) is for Distribution Percentage

aggr(avg({<[Provider Id]=>}(line_srvc_cnt/sum(total line_srvc_cnt)*100)),[HCPCS Code])  is for Avg of Distribution Percentage

Is there any alternate option to calculate the Average.

Thanks in Advance

4 Replies
hic
Former Employee
Former Employee

Look at Average – Which average?

Concerning your expressions:

1. You shouldn't have naked field references (See Use Aggregation Functions!😞

line_srvc_cnt/sum(total line_srvc_cnt)*100

2. You need to wrap your Aggr() function in an aggregation function. Otherwise you will have exactly the same problem with the Aggr() as you have with naked field references: If there are multiple values, it will be interpreted as NULL. Hence:

Avg( Aggr( ... ) )

HIC

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this expression

avg({<[Provider Id]=>} aggr(Sum({<[Provider Id]=>} line_srvc_cnt)/sum({<[Provider Id]=>} total line_srvc_cnt),[HCPCS Code])) * 100

Regards,

Jagan.

janardhan
Creator
Creator
Author

Hi jagan,

I tried the expression what u have posted still i'm not getting the values

jagan
Luminary Alumni
Luminary Alumni

Hi,

Can you attach sample file?

Regards,

Jagan.