5 Replies Latest reply: Aug 17, 2016 1:33 AM by Shivam Sarin

# How do I calculate the ratio of a sum total by each number of rows.

I want to get the ratio of total Store Sales ie 15.32M by each store sales. How can I get this division?

I tried putting the total Sales in a variable and then divided by using aggr function: Aggr(Sum(UNITS),STR_ACCOUNT_NAME_DESC).

I'm not getting the correct answer. I need it 15.32M/ Sales of store 1,Store 2 and so on in the table

• ###### Re: How do I calculate the ratio of a sum total by each number of rows.

May be this:

Sum(UNITS)/Sum(TOTAL UNITS)

or

Sum(TOTAL UNITS)/Sum(UNITS)

• ###### Re: How do I calculate the ratio of a sum total by each number of rows.

Many Thanks, It worked

• ###### Re: How do I calculate the ratio of a sum total by each number of rows.

Did you mark you own answer as correct by mistake .

I would suggest marking the response which is actually correct, so that future users can find it useful when they land on this page.

Qlik Community Tip: Marking Replies as Correct or Helpful

Best,

Sunny

• ###### Re: How do I calculate the ratio of a sum total by each number of rows.

Oops Sorry, My bad. I corrected my mistake.

• ###### Re: How do I calculate the ratio of a sum total by each number of rows.

Hi

try this !!!

Sum(Store Sales) /

Max(TOTAL Aggr(Sum(Store Sales),STR_ACCOUNT_NAME_DESC) ))

OR

Max(TOTAL Aggr(Sum(Store Sales),STR_ACCOUNT_NAME_DESC) ))/Sum(Store Sales)