Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Announcements

- Qlik Community
- :
- Forums
- :
- Analytics
- :
- New to Qlik Analytics
- :
- Qlik sense - Sort by expression (number) and conve...

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

varmekontrol

Creator

2017-09-15
05:43 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Qlik sense - Sort by expression (number) and convert number to string (text)

Hi Foks

I have been trying to understand the way to sort by expression and converting numbers in my table to string (text).

And this question may already have been answered numerous times in this forum, but apparently not in a way that I am able to understand it, and use the examples in my table.

The problem is the last Column (Fejlkode)

I would like if the data = errorState

Could be sorted so that the number '2' is always the first, and '4' is the second.

Also, i would like if the number '2' is converted to text 'Critical, must be replaced' and '4' converted to text 'Cold restart for 21 days'

Hope you are able to help me figure out how to approach this problem.

3,350 Views

1 Solution

Accepted Solutions

OmarBenSalem

MVP

2017-09-15
07:05 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

=if(Fejlkode=2,'Critical, must be replaced' ,

if(Fejlkode=4,'Cold restart for 21 days' ,

if(Fejlkode=0,'other')))

2,430 Views

6 Replies

arulsettu

Master III

2017-09-15
05:47 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

to convert try this

if(Fejlkode=2, 'Critical, must be replaced','Cold restart for 21 days') as fieldnameand sort this by Fejlkode

2,430 Views

OmarBenSalem

MVP

2017-09-15
06:01 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Create a new dimension as follow:

=if(Fejlkode=2,'Critical, must be replaced' ,'Cold restart for 21 days' )

and for the sorting, you have to put this dimension as the first one and sort it by expression (ascending) : Feljkode

2,430 Views

varmekontrol

Creator

2017-09-15
06:44 AM

Author

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

This one almost worked

if(Fejlkode=2, 'Critical, must be replaced','Cold restart for 21 days')

Only thing is that '0' now is Cold restart for 21 days

How do I define them individually

1=Name1

2=Critical

3=Name3

ect...

2,430 Views

OmarBenSalem

MVP

2017-09-15
07:05 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

=if(Fejlkode=2,'Critical, must be replaced' ,

if(Fejlkode=4,'Cold restart for 21 days' ,

if(Fejlkode=0,'other')))

2,431 Views

varmekontrol

Creator

2017-09-15
07:08 AM

Author

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

That did the trick

Also The dimension solution worked .....

Thx.

2,430 Views

Anonymous

Not applicable

2017-10-31
05:35 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Not working for me. My initial fields were coded as follows:

If(score <=590, 'LT 590',

IF(score >= 590 and score < 620, '590 - 620',

IF(credit >= 620 and score < 640, '620 - 640',

IF(score >= 640 and score < 680, '640 - 680',

IF(score >= 680 and core < 699, '680 - 699',

'700+')))))

In my expression I did the following:

If(score=1,'LT 590',IF(score=2,'590 - 620',

IF(score=3,'620 - 640',IF(score=4, '640 - 680',

IF(score=5,'680 - 699',IF(score=6,'700+'))))))

I also tried the reverse order in the expression as well with no success. I would appreciate any insight. Thanks

2,430 Views

Community Browser