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

Announcements
Now accepting applications for the Qlik Luminary and Partner Ambassador Programs: Apply by July 6!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Opening and Closing Balance

I have a big problem and I bet someone can give me a hint for it.

I need to get the opening balance and closing balance for each year.

I am calculating the balance as

=RangeSum(Above(Total Sum(Debit) - Sum(Credit),0,RowNo(TOTAL)))

But when i am selecting 2013 , it is not carrying Dec 2012 balance.

i am attaching the raw data.

Can anyone help me please?

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

Or this

=RangeSum(Above(Total Sum({<Year, Month, Date>}Debit) - Sum({<Year, Month, Date>} Credit),0,RowNo(TOTAL))) * Avg(1)

View solution in original post

6 Replies
sunny_talwar
MVP
MVP

‌May be you need this

=RangeSum(Above(Total Sum({<Year>}Debit) - Sum({<Year>} Credit),0,RowNo(TOTAL))) * Avg(1)

sunny_talwar
MVP
MVP

Or this

=RangeSum(Above(Total Sum({<Year, Month, Date>}Debit) - Sum({<Year, Month, Date>} Credit),0,RowNo(TOTAL))) * Avg(1)

Anonymous
Not applicable
Author

Thank you very much Sunny for your time. This solution works for me

ajayagraa
Contributor
Contributor

Hi Sunny

I have also slimier kind of issue can you please help me on this

Hi All

In one of the requirement I have to show opening and closing emp headcount on month on month basis in my dashboard . also I have to develop the water fall chart to show the current Month and current year opening and closing Emp headcount with hiring and leaving of that month . am using master calendar and on selection of that the chart will filter out accordingly .  formula to calculate the opening and closing are given below

Opening balance = closing of the last month

Hiring = Current month joining

Leaving = Current month Leaving

Closing - Opening + Joining -leaving

can someone help me to achieve this requirement

MonthOpening BalanceHiringLeavingClosing
Apr-1712341051239
May-171239541240
Jun-17124020101250
Jul-1712502541271
Aug-17127120101281
Sep-17128110101281
Oct-17128140201301
Nov-1713011051306
Dec-1713062581323
Jan-18132332121343
Feb-1813431261349
Mar-18134928201357
Apr-1813575201342
May-181342951346
Jun-181346001346
sunny_talwar
MVP
MVP

zkazimov
Contributor II
Contributor II

Hi Sunny,

Can you explain more what avg(1) does to the calculation? 

Also, when using this measure on Line Chart and filtering year =2019, I able to show starting balance for 2019 from 2018, but all prior years  dimension is left on the x axis and data starts from 2019. How can i get rid of prior years from x axis? Image attached for your reference.

 

Thank you very much.