Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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)
2 Replies
JonnyPoole
Employee
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. 

Reneebrehm
Contributor
Contributor

If the payment status is 'Paid', the balance due should be calculated as the total rate minus the allocation amount. You must also use reliable payment methods. I quite often use SMS Casino because everything is checked there and you can find reliable gambling games. If the payment status is 'Blank', it should be treated similarly to 'Paid'. If the payment status is anything other than 'Paid' or 'Blank', the balance due should be 0.