Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
MuraliPrasath
Creator III
Creator III

Difference Querry

Hi,

I've attached the qvw and data file.

I want to differentiate between months and want to get Rupees in Debit/Credit amount, but I'm getting wrong data.

Can anyone help me on this?

19 Replies
rubenmarin

In Feb you have 25 rupees more than you had in Jan.

Logic maybe can vary depending in wich selector has Feb and wich one has Jan

Gysbert_Wassenaar

That depends on how math is defined in your universe. In mine it's 0 minus -25 = 0 + 25 = 25. That's also how math is implemented in Qlikview.


talk is cheap, supply exceeds demand
MuraliPrasath
Creator III
Creator III
Author

Capture.JPG

In Jan we earned 17 Rupees

In Feb we spent -36 Rupees

so they left out credit balance is -19 right?

rubenmarin

No Murali, in Jan you have a positive 17, in Feb you have a negative 36, that's a difference of 53, the symbol (positive or negative) will depend on the order of the operators, but the '53' will be kept.

Gysbert_Wassenaar

Yes, the difference between -36 and 17 is -19:  -36 + 17 = -19. If both numbers are credit amounts then the credit balance between the two is -19.

Perhaps this helps: Adding & subtracting negative numbers | Negative numbers |Khan Academy


talk is cheap, supply exceeds demand
rubenmarin

Or maube you're asking about cummulative sums, not differences, in that case use:

Column(2)+column(1)

MuraliPrasath
Creator III
Creator III
Author

How to use cumulative here?

just Column(2)+column(1)  ???

rubenmarin

That will sum the value from the first column with the value in the second column.

Note that's not a difference, is an accumulation, ie:

Jan Feb TOTAL

10   15   25

-10  5     -5

MuraliPrasath
Creator III
Creator III
Author

thank you, I was so stupid today. lol

rubenmarin

Glad to help.

Think twice about your final expression, if you're using alternate states and one is called 'comparemonth' maybe the intention should be to check the differences, not an accumulation (this can be done with only one state, no need of altern states).

Just quietly review your requirements and the answers in this thread to find the optimal solution.