Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
saurabh_Qlik1
Contributor III
Contributor III

How to sort order a chart dimension containing Text and Dates

I am creating a line chart using the following data table:

Price Dimension
80% valuation price
76% 1/31/2023
74% Origination price
73% 2/28/2023
71% 3/31/2023

 

I get the following line chart:

sau953_Qlik_1-1685720338787.png

 

It not that clear, but as you can see, I get all the dates together then origination price and then valuation price. Is there a way to first get the origination price, then the dates and then the valuation price?

The dates are not fixed and can change based on some factors but the labels 'origination price' and the 'valuation price' will remain fixed. 

Please help!

2 Solutions

Accepted Solutions
kleman_emark
Partner - Contributor III
Partner - Contributor III

Hi @saurabh_Qlik1 ,

you can make the dimension a dual value pair and then on the front end use the numerical part for the sorting.

In the load script you could prepare the values in the following way:

Price_Overview:
LOAD
dual( text(Dim),
      if(
          match(Dim,'Origination price','Valuation price'),
          pick(match(Dim,'Origination price','Valuation price'),0,100), 
            rowno()
          )
    ) as Dim,
    Price
;
load * Inline [
Dim,Price
1/31/2023,76%
2/28/2023,73%
3/31/2023,71%
Origination price,74%
Valuation price,80%
];

 

And then in the line chart set the Sorting to sort by Dim and Sort numerically.

Hope that helps,

Tomas

View solution in original post

Gabbar
Specialist
Specialist

You can create a new Column in Backend and assign them relative value to dimension and then use that dimension in Customize sorting option,
Or if you have limited number of Dimension Value then you can use If statement to generate those values in Customize sorting option Only.

View solution in original post

2 Replies
kleman_emark
Partner - Contributor III
Partner - Contributor III

Hi @saurabh_Qlik1 ,

you can make the dimension a dual value pair and then on the front end use the numerical part for the sorting.

In the load script you could prepare the values in the following way:

Price_Overview:
LOAD
dual( text(Dim),
      if(
          match(Dim,'Origination price','Valuation price'),
          pick(match(Dim,'Origination price','Valuation price'),0,100), 
            rowno()
          )
    ) as Dim,
    Price
;
load * Inline [
Dim,Price
1/31/2023,76%
2/28/2023,73%
3/31/2023,71%
Origination price,74%
Valuation price,80%
];

 

And then in the line chart set the Sorting to sort by Dim and Sort numerically.

Hope that helps,

Tomas

Gabbar
Specialist
Specialist

You can create a new Column in Backend and assign them relative value to dimension and then use that dimension in Customize sorting option,
Or if you have limited number of Dimension Value then you can use If statement to generate those values in Customize sorting option Only.