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: 
Not applicable

Pivot Subtotals

have a normal pivot chart, the values are correct but the subtotals of the percentages are causing problem,

This is the O/P got,

StatusComplianceNANonComplianceTotal
ProcessQuestion%Count%Count%Count%Count
Fixing1822261849100275
2872401335100275
33997266100275
Total447523010496825

Expression Used

% =  

Count

(Compliance_Report.FILE_NO)/Count(total<Compliance_Report.QUESTION> Compliance_Report.FILE_NO

)

Count=

 

Count

(Compliance_Report.FILE_NO

)

have marked the subtotals Question and Status

in % compliance total, shld get 57% which is the average of the above 3 %s

in % NA total, shld get 45% which is the average of the above 3 %s

in % Noncompliance total, shld get 6% which is the average of the above 3 %s

Can pls anybody explain wht wrong i did and hw to rectify the issue,

5 Replies
er_mohit
Master II
Master II

Tried to put this condition in sum()

sum(Compliance_Report.FILE_NO)/Count(total<Compliance_Report.QUESTION>Compliance_Report.FILE_NO

)


sum(Compliance_Report.FILE_NO

)

hope it helps

Gysbert_Wassenaar

You want an average of relative counts. That's not what you specified. You only told QV to calculate the counts. Try using the aggr function to aggregate and aggregation, i.e. average a count over N dimensions:

avg(aggr(Count(Compliance_Report.FILE_NO)/Count(total<Compliance_Report.QUESTION> Compliance_Report.FILE_NO), Compliance_Report.PROCESS, Compliance_Report.QUESTION)

Compliance_Report.PROCESS is a guess on my part. Replace that with the actual dimension name.


talk is cheap, supply exceeds demand
Not applicable
Author

Hey Gysbert, i tried ur exp

but nt getting the desired output, many percentages are missed and those got are showing 100%.

Subtotals are correct but the % for each qtn is wrong.

I need the % to be w.r.t each qtns and then the subtotals to be showing avg of the % gt collectively.

Can u help!!

Gysbert_Wassenaar

Ok, try using the dimensionality function. First add an expression with only dimensionality() so you can see what level the subtotals get. Then create an if statement using the dimensionality function to use the right expression for the right level:

if(dimensionality() = 2 , count_expression_here, avg_aggr_expression_here)

Change dimensionality() = 2 to whatever it needs to be for your chart.


talk is cheap, supply exceeds demand
Not applicable
Author

Thnks the first expression stated by you has worked ......

Gysbert, Can u throw some light on the dimensionality()  function, i didnt understnd the functionality of this function, hw it works.