Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

yangcelinexu
Contributor

sorting fileds in filter

Hi

I am creating a filter have 3 filed (revenue, profit, profit_margin)

I want to have it as this order to show on the dashboard, any suggestion how could I sort?

Now is look like this

Screen Shot 2018-05-05 at 08.05.07.png

use expression?

or do you have any suggestion using some easier way to just reorder the fields ?

Thank you!

Tags (3)
7 Replies
benazirkhan
Contributor II

Re: sorting fileds in filter

You could try sorting by frequency if your data has more records for revenue, and next for profit and then for Profit-margin.

But if that's not the case - you should try the expression. (you could add an extra column to your data called Filter_flag and populate it as 1 for Rev, 2 for margin and 3 for profit.

Then use and expression to sort it using this field.

Let me know if that helps.

rgds,

Benazir

MVP
MVP

Re: sorting fileds in filter

you can sort by expression

mixmatch(yourfield, 'Revenue', 'Profit', 'Profit_margin')

MVP
MVP

Re: sorting fileds in filter

another option

1) load in a temporay table the values in the order you want at the beginning of the script

2) load other tables

3) drop the temporary table

the field is sorted (load order) as you define in step 1

// step 1

tmpSortField:

load * inline [

field

Revenue

Profit

Profit_margin

];

// step 2

Table:

load * inline [

field, val

Profit_margin, 1

Profit , 2

Revenue, 3

];

b:

load

pick(ceil(rand()*3), 'Revenue', 'Profit', 'Profit_margin') as field,

rand()*100 as val

AutoGenerate 1000;

// step 3

DROP Table tmpSortField;

sasiparupudi1
Honored Contributor III

Re: sorting fileds in filter

Use the expression

Pick (match (

'Profit_margin',

'Profit',

'Revenue')

,1,2,3)

ogster1974
Honored Contributor II

Re: sorting fileds in filter

Sort by expression

Valuelist(revenue, profit, profit_margin)

mikaelsc
Contributor III

Re: sorting fileds in filter

yangcelinexu
Contributor

Re: sorting fileds in filter

Thank you so much for all the input. All of them are working. --want to mark all as correct answers.

Thanks again for all the input!

I did it in another way. only works in this case because the number of Income>Profit>Profit margin

so I use expression just using sum(Total) as ranking

Community Browser