Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to turn a dimension in the same table?

Hi,

I've encountered a problem I can not solve and need some help!

I have the dimensions "From Destination" and "To Destination". I use this to calculate the number of tons between differents locations, with the expression sum(tons). But, I need to turn this expression to how many tons who are sent back along the same line in return.

In other words, I must fetch up the "To Destination" and make it calculate this as an "From Destination". I tried to use SET expression like Sum({$<[From Destination] =  {[To Destination]}>} Tons), but it returns only zero...

Is there anyone who can help with some suggestions here?


///Tom

1 Solution

Accepted Solutions
ankitaag
Partner - Creator III
Partner - Creator III

Hi Tom,

Finally !! so glad to do this.

Kindly find the attached app.

Final result is exactly what you want.

Hope this is correct and helpful!

Thanks and Regards,

Ankita

View solution in original post

13 Replies
ankitaag
Partner - Creator III
Partner - Creator III

Hi Tom,

Qlikview doesn't allow to column names to be same.

So you need to change the 2nd From and To Destination to From Destination 1 and To Destination 1 and Tons to be Tons Returned.

That way it will be easy for you to write an expression.

Because I suppose you need extra column for Return from London to Oslo as shown in your image

awhitfield
Partner - Champion
Partner - Champion

Hi Tom,

can you post your qvw?

Regards

Andy

Not applicable
Author

Hi Andrew,

This is just a test file since the original is too big and not allowed to publish (company rule).

Hope this helps describing my problem...

///Tom

ankitaag
Partner - Creator III
Partner - Creator III

Hi Tom,

You can store the From Destination value in vTo variable (Oslo) and ToDestination value in vFrom variable (London).

and in the expression you can write

=sum({<[From Destination]={'$(vTo)'},[To Destination]={'$(vFrom)'}>}Tons)

ankitaag
Partner - Creator III
Partner - Creator III

Do you have just 1 from and To location or you have many?

Not applicable
Author

Hi Ankita,

No, I have over 300....
///Tom

ankitaag
Partner - Creator III
Partner - Creator III

Hi Tom,

Can you please look over the attached app..

I have made some changes in the script

Not applicable
Author

Hi Ankita,

Thank you for responding and for the changes you did in the QV! This was good input and a new approach!

However, I want the returned tonnes in the same line as in the example picture that is attached.

Anyway, thanks responding! I really appreciate that!

///Tom

ankitaag
Partner - Creator III
Partner - Creator III

In your data table you have a separate row for the returns right?

Cant we bring them to the same row by creating extra columns?