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: 
kkkumar82
Specialist III
Specialist III

Percentage calculation when using Max function

All,

I have faced a issue today on the percentage calculation issue, where in the numerator is a sum value when as the denominator is a max

value, the individual row value percentages are looking correct but the grand totals were incorrect.

Just attaching a file, with a sample, hope it explains my problem.

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

I am still not sure, but may be try this

Sum(Aggr(Max(MarksScored), Sno))/Sum(Aggr(Max(MaxMarks), Sno))

View solution in original post

11 Replies
vinieme12
Champion III
Champion III

max.PNG

The Expression is correct

This is how the Expression total for MAx is being calculated

Max(MarksScored) = 89

Max(Marks) = 100

so 89%


if for any of the subjects max marks were 200 then Expression Total would show = 89/200


Hope this helps


Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
sunny_talwar
MVP
MVP

Or this:

Marks Scored

Max(Aggr(Sum(MarksScored), Sno))

Max Marks

Max(Aggr(Sum(MaxMarks), Sno))

kkkumar82
Specialist III
Specialist III
Author

Hi sunny,

The original problem I have got fixed , using aggr, but the sample I have provided , if you see that, the percentage

should be 556/700 = 79.43% but because of using Max() the percentage is coming as 89%, any fix for this.

sunny_talwar
MVP
MVP

You want 79.43? I thought you wanted 89%. To get 89%, why not just use this?

Sum(MarksScored)/Sum(MaxMarks)

kkkumar82
Specialist III
Specialist III
Author

For this case , I can use Sum() but is there a way can we get with Max()

sunny_talwar
MVP
MVP

I have no idea what you are looking for Kiran. Do you want to expand a little on what you are doing?

kkkumar82
Specialist III
Specialist III
Author

As per your suggestion I can go with Sum(MarksScored)/Sum(MaxMarks) but I am asking you whether is it possible to the percentage 79 still using Max() function.

Hope I am clear this time

sunny_talwar
MVP
MVP

I am still not sure, but may be try this

Sum(Aggr(Max(MarksScored), Sno))/Sum(Aggr(Max(MaxMarks), Sno))

kkkumar82
Specialist III
Specialist III
Author

You picked it this time as always ..........