Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
cancel
Showing results for 
Search instead for 
Did you mean: 
FerdiSisko
Partner
Partner

Bar Chart: "Sorting"/Ordering bars: <$100K, $100K to $500K, $500 to $1M, $1M to $5M

I'm trying to create bar chart that tracks the number of contracts that fit into a range of <$100K, $100K to $500K, $500 to $1M, $1M to $5M. How would I ensure that the order of the bars appear in that order? I thought I might use an alphabetical prefix for sorting like A) <$100K,  B) $100K to $500K, C) $500 to $1M, D) $1M to $5M  but this seems awkward if one or more categories is missing. 

What would you advise? 

Labels (2)
2 Replies
skamath1
Creator III
Creator III

You can use a dual and applymap function to add sorting.

Dual accepts a parameter for string and number for sort.  See the sample code below using ApplyMap and Dual

TestMap:

Mapping

Load * Inline [

Value, SortNo

'<$100K', 10 

'$100K to $500K',20

' $500 to $1M',30

'$1M to $5M', 40

] ;

You can now use applymap

 Load * , 

        Dual( YourFieldName, ApplyMap('TestMap', YourFieldName,0)  as YourFieldName  

from ...  ;

Replace the YourFieldName with your field name from the dataset.

 

https://help.qlik.com/en-US/sense/November2020/Subsystems/Hub/Content/Sense_Hub/Scripting/MappingFun...

https://help.qlik.com/en-US/sense/November2020/Subsystems/Hub/Content/Sense_Hub/Scripting/Formatting...

 

 

 

 

FerdiSisko
Partner
Partner
Author

@skamath1 Thank you for your reply! I appreciate your comment and will take a look at it.