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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Division of two sums to get percentage

Hi All,

I have a pivot table in which i calculate the total depositors and then i need to calculate the % of the total depositors.

The total depositors are calculated as follows;



Sum({<TRANSACTION_HISTORY.VALUE_DATE= {"<$(=CALENDAR.VAR_DATE_ONE)"}>} If(Left(GENERAL_LEDGER.GL_CODE,1)<>1 and Left(GENERAL_LEDGER.GL_CODE,2)<>21 and Left(GENERAL_LEDGER.GL_CODE,2)<>28,TRANSACTION_HISTORY.CV_AMOUNT))

Whereas the % of total depositors is caluculted as;



Sum

({<TRANSACTION_HISTORY.VALUE_DATE= {"<$(=CALENDAR.VAR_DATE_ONE)"}>} If(Left(GENERAL_LEDGER.GL_CODE,1)<>1 and Left(GENERAL_LEDGER.GL_CODE,2)<>21 and Left(GENERAL_LEDGER.GL_CODE,2)<>28,TRANSACTION_HISTORY.CV_AMOUNT))/Sum({<TRANSACTION_HISTORY.VALUE_DATE= {"<$(=CALENDAR.VAR_DATE_ONE)"}>} If(Left(GENERAL_LEDGER.GL_CODE,1)<>1 and Left(GENERAL_LEDGER.GL_CODE,2)<>21 and Left(GENERAL_LEDGER.GL_CODE,2)<>28,Sum(total TRANSACTION_HISTORY.CV_AMOUNT)))

The problem occurs with the % of total depositors wherein the field is shown with a '- '. This problem occurs because i have added code to obtain amounts as per current date.

Please can someone help me with this. Many Thanks.

Best Wishes & Regards.



1 Solution

Accepted Solutions
Not applicable
Author

Hi,

I have the solution and instead of going through such a long process.

I have found the solution and we can use the following;

Sum(Amount) / Sum(total Amount)

So in my expression it would appear as;

Sum({${<TRANSACTION_HISTORY.VALUE_DATE= {"<$(=CALENDAR.VAR_DATE_ONE)"}>} If(Left(GENERAL_LEDGER.GL_CODE,1)<>1 and Left(GENERAL_LEDGER.GL_CODE,2)<>21 and Left(GENERAL_LEDGER.GL_CODE,2)<>28,TRANSACTION_HISTORY.CV_AMOUNT))

/

Sum({${<TRANSACTION_HISTORY.VALUE_DATE= {"<$(=CALENDAR.VAR_DATE_ONE)"}>} total If(Left(GENERAL_LEDGER.GL_CODE,1)<>1 and Left(GENERAL_LEDGER.GL_CODE,2)<>21 and Left(GENERAL_LEDGER.GL_CODE,2)<>28,TRANSACTION_HISTORY.CV_AMOUNT))

View solution in original post

3 Replies
Not applicable
Author

Hi,

In QlikView, if you are using SET analysis then there is no need to use IF function.

In your case, you are using both SET and IF.

You can apply SET for General_Ledger.GL_Code also.

Then try to get ratio.

Still if problem persists, share sample data.

Happy Thoughts

Not applicable
Author

Hi Ravi,

I'm sorry but I dont follow.

Im getting the ratio if i do it as per a fixed date, but when i link it to a calender object and try to generate the data per different dates the ni get null values.

Since i pull the data using qlikview connection to my company server, it would be difficult to replicate the data and share it.

Regards.

Not applicable
Author

Hi,

I have the solution and instead of going through such a long process.

I have found the solution and we can use the following;

Sum(Amount) / Sum(total Amount)

So in my expression it would appear as;

Sum({${<TRANSACTION_HISTORY.VALUE_DATE= {"<$(=CALENDAR.VAR_DATE_ONE)"}>} If(Left(GENERAL_LEDGER.GL_CODE,1)<>1 and Left(GENERAL_LEDGER.GL_CODE,2)<>21 and Left(GENERAL_LEDGER.GL_CODE,2)<>28,TRANSACTION_HISTORY.CV_AMOUNT))

/

Sum({${<TRANSACTION_HISTORY.VALUE_DATE= {"<$(=CALENDAR.VAR_DATE_ONE)"}>} total If(Left(GENERAL_LEDGER.GL_CODE,1)<>1 and Left(GENERAL_LEDGER.GL_CODE,2)<>21 and Left(GENERAL_LEDGER.GL_CODE,2)<>28,TRANSACTION_HISTORY.CV_AMOUNT))