Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

dselgo_eidex
Contributor II

QlikSense sort a dual() calculated dimension

Hello, I am trying to make a pivot table in QlikSense where the dimension is =dual(Name, ID). I want the table to show the names in alphabetical order, but it doesn't seem to be doing that.

I've tried the following:

  • Sort alphabetically
  • Sort by Expression (I tried "=Name" and "=Only({1} Name)")

Any help would be appreciated.

1 Solution

Accepted Solutions
mikaelsc
Contributor III

Re: QlikSense sort a dual() calculated dimension

(was already expecting this :-)

add the "alphabetical value" in your script by sorting your table by name asc, and adding rowno() as "the alphabetical" order.

17 Replies
zebhashmi
Valued Contributor

Re: QlikSense sort a dual() calculated dimension

Maybe sort by expression =Left(Name,1)

dselgo_eidex
Contributor II

Re: QlikSense sort a dual() calculated dimension

Nope, didn't work. I think Sort by Expression expects numeric values in order to sort.

mikaelsc
Contributor III

Re: QlikSense sort a dual() calculated dimension

does it also fail when you create your dual dimension in the script?

(i tend to avoid calculated dimensions in objects)

isingh30
Contributor III

Re: QlikSense sort a dual() calculated dimension

Can you share your data or sample application? Pivot table shows dimension in ascending order by default.

Thank you!

thiago_justen
Valued Contributor III

Re: QlikSense sort a dual() calculated dimension

It will be great if you could share an example app. However, be careful when using dual function with sorting purpose:

Dual function help: "When several data items read into one field have different string representations but the same valid number representation, they will all share the first string representation encountered."


Share a sample and we will be able to help you.


Cheers

Thiago Justen Teixeira Gonçalves
WhatsApp: 24 98152-1675
Skype: justen.thiago
dselgo_eidex
Contributor II

Re: QlikSense sort a dual() calculated dimension

I created a sample app that should show what I am referring to.

The tables that are using the dual() dimension function properly, but they do not sort alphabetically according to the string field. The tables that use the name field sort correctly, but it groups together people with the same name even if they have different IDs.

I also tried creating a Dual field in the load script, but it did not help.

thiago_justen
Valued Contributor III

Re: QlikSense sort a dual() calculated dimension

Are you able to share an example app?

Thiago Justen Teixeira Gonçalves
WhatsApp: 24 98152-1675
Skype: justen.thiago
dselgo_eidex
Contributor II

Re: QlikSense sort a dual() calculated dimension

I attached one above.

mikaelsc
Contributor III

Re: QlikSense sort a dual() calculated dimension

Hi Danny,

referring to the help:

https://help.qlik.com/en-US/sense/September2017/Subsystems/Hub/Content/Scripting/FormattingFunctions...

Dual() combines a number and a string into a single record, such that the number representation of the record can be used for sorting and calculation purposes, while the string value can be used for display purposes.


so sorting a dual value alfabetically, comes to sorting it numerically.

if you want to use the text value for sorting, you'll have to use an expression using the text dimension

Community Browser