Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Difference of 2 columns in straight table

Hi,
I am using straight table to display data. In dimension I have given months. So, the data is displaying month wise. Now my requirement is I have to display the difference of the 2 columns data in third column.
So, I have to creat another dimension but I don't know how to get difference of two column in third column.

Any body has any idea. Please let me know.

Thanks

8 Replies
Not applicable
Author

what kind of data are you subtracting??

if your subtracting the values of two fields maybe you can use a calculated dimension..

Not applicable
Author

I am trying to use calculated dimension only but how I'll substract column B data from column A data because these are generating from expression and each row has different expression.

Here only I stucked, what to do.

Suppose 1 expression is profit. So, 1st column is showing profit of Jan month and 2nd column is showing profit of Feb month.

Now 2nd expression is Order. So, 1st column is showing Order of Jan month and 2nd column is showing Order of Feb month.

So, in the 3rd colum I need difference of these data expression wise. How to do it. Any idea.

tresesco
MVP
MVP

Have you tried something like Column(A)-Column(B) ?

Regards, tresesco

Not applicable
Author

As suggested by tresesco, pls find the diff between 2 columns.

1st column is Profit and 2nd column is Order.

3rd expression should be [Profit] - [Order] provided both are of same data type.

Not applicable
Author

Sorry to reply late but It is not working. I have attached the screen shot.

Here in column Dec-10 data is showing for expressions Order, Cost and Revenue for its month. Column Nov-10 is also showing data for its month. Here Dec-10 and Nov-10 are the part of dimension Prior 2 Mon-Yrs. Now I want a 3rd column which would show 'UP' or 'DOWN' based on the difference of column 'Dec-10' minus 'Nov-10'.

Please let me know hwo to achieve it.

Not applicable
Author

Hi,

If this is a straight table, I think that the following might work to find the difference between Dec-10 and Nov-10

If(Sum(Column(0))-Sum(Column(1)) < 0, 'UP', 'DOWN')

or

If(Sum([Dec-10])-Sum([Nov-10]) < 0, 'UP', 'DOWN')

Thanks

Not applicable
Author

Hi Nick,

I tried both in Pivot table and straight tables. Can you please tell me where I have to define this condition, in Dimension or in Expression. Also, I need expression wise UP or DOWN not the total i.e if Order amount in Dec-10 > Nov-10 then 'UP' in the 3rd column of the Order row. Similarly, Profit in Dec-10 < Nov-10 then 'DOWN' in the 3rd column of the Profit row. like this...

Thanks

Not applicable
Author

Hello Dear ,

please try this in you experssion :

let your 1 expression : column 1

and 2 expression : column 2

now in third expression write column(2) - column(1)

this will give you diffrence of you above both expression