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

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
pgloc2020
Creator
Creator

How to calculate "Balance Due"

Hello,

I have following data-

pgloc2020_0-1711563758168.png

If above scenario, balance due is $60. Because the payment made by CC somehow did not go through even though status shows "Paid".  

How I can calculate the "Balance Due" in Qlik?

I used the following expression but it is not working in above example.  I am getting Balance Due = 0 instead of 60

IF(([PAYMENT_STATUS] = 'Paid' OR [PAYMENT_STATUS] = 'Blank') ,
SUM(TOTAL_RATE) - SUM(ALLOCATION_AMOUNT))

I also used following but not getting correct Balance due amount-

IF(([PAYMENT_STATUS] = 'Paid' OR [PAYMENT_STATUS] = 'Blank') AND [2nd_LOCK] = 'Y', SUM(TOTAL_RATE) - SUM(ALLOCATION_AMOUNT), 0 )

Please help me to correct my formula to calculate the correct "Balance Due"

I have this column in a straight table chart as a measure. 

Many thanks!

Labels (3)
1 Reply
JonnyPoole
Former Employee
Former Employee

Its not clear to me what the field names are in your data model vs. what is in your screenshot above. 

It sounds like you need to total up the amount due:

Sum( Total [AmountDue]) 

..and then subtract the amount paid:

-Sum(Total [AmountPaid]) 

So the answer would be: 

=Sum( Total [AmountDue]) -Sum(Total [AmountPaid]) 

But that's just a guess.