Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Hauglaen
Contributor II
Contributor II

Customize interval in Bar Chart

Hi,

I have the following type of dataset:

DateIDCopies sold
01.01.20201200
01.01.20201100
05.01.20202500
06.01.202035
07.01.202035
08.01.202035
09.01.20204100
09.01.2020450

 

I have a Bar Chart and want to count number of ID's based on copies sold in interval 0-99, 100-499, 500+.

 

Thank you!

 

 

1 Reply
jonathandienst
Partner - Champion III
Partner - Champion III

You can build a dimension in the front end, but a better way is to do an interval match. Apart from being fster, it salso easier to maintain (for example, changing the bands). Follow this code pattern (adapt to your specific case):

Intervals:
LOAD * Inline
[
	From, To, BandName
	0, 99, 0-99
	100, 499, 100-499
	500, 1E6, 500+
];

Left Join (Fact)
IntervalMatch([Copies Sold])
LOAD From, To
Resident Intervals;

// OPTIONAL
Left Join (Fact)
LOAD *
Resident Intervals;

Drop Table Intervals;

The "OPTIONAL" code is not essential, although I prefer to clean up my data model, which that code does.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein