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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
langelwong
Partner - Contributor III
Partner - Contributor III

Count Avg in Pivot table

Hello,

Im trying to make a pivot table with a calculated field that shows the count when an avg get more than 100%. But i cant get the correct values.

Capture.PNG

 

The expression I used is :

if(SecondaryDimensionality()=0,
count({<ETIQUETA={'%','% Cumpl.','Parti.'},CANAL={'02. Red Agencia'},NIVEL={'01. Área'},PERIODO={'MENSUAL'}>}
Aggr(if(
Num(Alt(avg({<ETIQUETA={'%','% Cumpl.','Parti.'},CANAL={'02. Red Agencia'},NIVEL={'01. Área'},PERIODO={'MENSUAL'}>}RESULTADO),''),'#,##0%')>=1,1,0)
, CODPERIODO)),
CHR(9679)&' '& Num(Alt(avg({<ETIQUETA={'%','% Cumpl.','Parti.'},CANAL={'02. Red Agencia'},NIVEL={'01. Área'},PERIODO={'MENSUAL'}>}RESULTADO),''),'#,##0%')&' ')

Any ideas?

 

 

Labels (2)
1 Solution

Accepted Solutions
langelwong
Partner - Contributor III
Partner - Contributor III
Author

So I solved it by correcing the order from the aggr

somthing like this

if(SecondaryDimensionality()=0,
sum(
Aggr(
if(
Num(Alt(avg(RESULTADO),0),'#,##0%')>=1,1,0)
,CODPERIODO)
),
CHR(9679)&' '& Num(Alt(avg(RESULTADO),''),'#,##0%')&' ')

View solution in original post

3 Replies
Anil_Babu_Samineni
MVP
MVP

Try this way

Count((if(SecondaryDimensionality()=0,
count({<ETIQUETA={'%','% Cumpl.','Parti.'},CANAL={'02. Red Agencia'},NIVEL={'01. Área'},PERIODO={'MENSUAL'}>}
Aggr(if(
Num(Alt(avg({<ETIQUETA={'%','% Cumpl.','Parti.'},CANAL={'02. Red Agencia'},NIVEL={'01. Área'},PERIODO={'MENSUAL'}>}RESULTADO),''),'#,##0%')>=1,1,0)
, CODPERIODO)),
CHR(9679)&' '& Num(Alt(avg({<ETIQUETA={'%','% Cumpl.','Parti.'},CANAL={'02. Red Agencia'},NIVEL={'01. Área'},PERIODO={'MENSUAL'}>}RESULTADO),''),'#,##0%')&' '))>=Num(100, '#,#0%'))

Or

Use, Aggregation to all fields like

Count(Aggr(if(SecondaryDimensionality()=0,
count({<ETIQUETA={'%','% Cumpl.','Parti.'},CANAL={'02. Red Agencia'},NIVEL={'01. Área'},PERIODO={'MENSUAL'}>}
Aggr(if(
Num(Alt(avg({<ETIQUETA={'%','% Cumpl.','Parti.'},CANAL={'02. Red Agencia'},NIVEL={'01. Área'},PERIODO={'MENSUAL'}>}RESULTADO),''),'#,##0%')>=1,1,0)
, CODPERIODO)),
CHR(9679)&' '& Num(Alt(avg({<ETIQUETA={'%','% Cumpl.','Parti.'},CANAL={'02. Red Agencia'},NIVEL={'01. Área'},PERIODO={'MENSUAL'}>}RESULTADO),''),'#,##0%')&' '), Dim1, Dim2)>=Num(100, '#,#0%'))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
langelwong
Partner - Contributor III
Partner - Contributor III
Author

I tried the first way but I can't be a nested aggregation 

and the second way turns all my values to 0.

langelwong
Partner - Contributor III
Partner - Contributor III
Author

So I solved it by correcing the order from the aggr

somthing like this

if(SecondaryDimensionality()=0,
sum(
Aggr(
if(
Num(Alt(avg(RESULTADO),0),'#,##0%')>=1,1,0)
,CODPERIODO)
),
CHR(9679)&' '& Num(Alt(avg(RESULTADO),''),'#,##0%')&' ')