Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dual Function not working

I'm not sure how to use this function. The examples I've seen seem to focus on dates and such and not really fields with good examples. I'm using qlik sense and have data coming in. I want to take the dimension I'm using and sort based on the text in a bar chart but for some reason the sort isn't working and someone suggested using the dual function.

Here is the data I'm loading:

Load

     NonCustomer

     GroupItem,

     Pick(WildMatch(GroupItem, '*Arcadia*','*Airman*'),'Other', GroupItem) as NewNonCustomer;

Load

     NonCustomer

     SubField(NonCustomer, ',') as GroupItem;

The data loads and I pull in the dimension to the chart, GroupItem and the measure, GroupItem(Count). When the chart displays, I get the correct data but the data does not sort alphabetically even though qlik sense says it is. The data displays as follows:

Arcadia

Customer1

Airman

USGee

Chordia

Someone suggested using the dual function but that doesn't seem to work.

3 Replies
vinieme12
Champion III
Champion III

can you post a sample app?

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
b_garside
Partner - Specialist
Partner - Specialist

Where and how is Dual () being used? Sample will help.

prieper
Master II
Master II

As kind of one-off you may enter an expression into the sort-properties of an object:

MATCH(Customer, 'USGhee', 'Airman', 'Chordia', ......)

would sort the customer in the order of the Match, i.e. USGhee first, then Airman etc ...

When you wish to reuse this kind of order, you may load the sortorder (from extern, or as INLINE):

MapSort: MAPPING LOAD * INLINE [Customer, SortOrder

USGhee, 1

Airman, 2

Chordia, 3

....];

When you load your data, you may add the DUAL-function:

Data: LOAD *, DUAL(Customer, APPLYMAP('mapSort', Customer))          AS Customer_ord

FROM ....;

With this a number would be attached to the customer. In Tables etc this field will behave like a number (sorting, rightbound etc.).