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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

question in set analysis

please i have a problem

i have 3 variables vBeforeDate and vStartDate and vEndDate

and 5 columns : CompanyName, Date, Debit, Credit, Balance

i want when i enter date in vBeforeDate variable tyhe balances till this date are summed and this is balance before this date

for dates after this one (in the beriod of  vStartDate and vEndDate)

the balance = balance before+debit-credit

ex:

balance before 1/1/2011 was 400

and i have 2 dates after that

30/1/2011  debit=10 credit= 20  so balance should be 400+10-20=390

and

5/2/2011 debit=100 credit= 30 so balance should be the last balance which is 390+debit-credit ....> 390+100-30=460

so the problem is how to add to each row the balnce of the before row

The attachment below can clarify my problem

1 Solution

Accepted Solutions
Not applicable
Author

i answered it

i got the idea from this thread and enhanced it

http://community.qlik.com/message/82992#82992

here is the final solution

View solution in original post

7 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   Can you please provide the qvw file.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Here it's ..

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

 

   Here is a set expression which will give you the balance between the startdate and enddate.

   sum({1<Date = {">=$(#vStartDate)<=$(#vEndDate)"},Year = ,Month =>}Debit -Credit)

   You can use the same for getting balance before date.

   Meaning enter the startdate as 0 and end date as the date before which you want the balance.

  

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Many Thanks for ur help

but i know this is to get the balance between 2 dates

but what i want is to add the balance before to be the new balance

i mean each row the balance of the above raw is added to the new calcualtion

i know how to makle this but in the first raw i want to add expression and in other raws another expression

like the example i explained above in the main thread

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   The answer to your question

"i know how to makle this but in the first raw i want to add expression and in other raws another expression"

   is that you can use the if statement, say

   if(rowno() = 1, this expression, other expression)

Regards,

Kaushik Solanki 

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Thanks Alot

i write it but the result is not OK

can you Please see attached qvw file and expressions in it

Not applicable
Author

i answered it

i got the idea from this thread and enhanced it

http://community.qlik.com/message/82992#82992

here is the final solution