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: 
Jfurbershaw
Contributor II
Contributor II

How do I divide by the max value in a column?

Hello!

Say I have a table where my first column is the name of the product and the second column is the total revenue of the product during a 12 month period. In the third column, I'd like to calculate the total revenue for the product during the 12 month period *divided by* the total revenue of the product with the max revenue during the 12 month period (from the second column). I can't figure out the right combination of max, aggr, and sum. Could anyone help? Thank you!!

Product Name 12 Month Revenue % of Max 12 month revenue
Product A $1,100 34.38%   (e.g., (1,100 / 3,200)*100)
Product B $2,400 75.00%   (e.g., (2,400 / 3,200)*100)
Product C $3,200   (MAX) 100.00%
Product D $1,900 59.38%
Product E $2,800 87.50%

 

Labels (2)
1 Solution

Accepted Solutions
Kushal_Chawda
MVP
MVP

@Jfurbershaw  try below

=SUM ({<YEAR = {2023}>}RTOTAL)/
max(total aggr(SUM ({<YEAR = {2023}>}RTOTAL),Product))

View solution in original post

4 Replies
Kushal_Chawda
MVP
MVP

@Jfurbershaw  What is the expression for 12 months revenue? or is it pre-calculated column?

Jfurbershaw
Contributor II
Contributor II
Author

@Kushal_Chawda It would be something along the lines of:  SUM (IF(YEAR = 2023, RTOTAL))

Thank you!

Kushal_Chawda
MVP
MVP

@Jfurbershaw  try below

=SUM ({<YEAR = {2023}>}RTOTAL)/
max(total aggr(SUM ({<YEAR = {2023}>}RTOTAL),Product))
Jfurbershaw
Contributor II
Contributor II
Author

@Kushal_Chawda That worked!! Thank you so much!