A bar chart is usually defined with one or two dimensions and a measure. However, we need to have dimensionless bar charts while designing KPIs on the dashboards and also in certain other scenarios. By default, Qlik Sense will not allow this. However, there is a workaround that is discussed in the following sections.
We will make use of the same application that we developed for the KPI recipe. The application has got the following script loaded, which gives information on the Sales
and Target
values for four countries. In addition, we will add a new column called as Dummy
.
Make sure to save and load the script once the Dummy
field is added:
LOAD * , 1 as Dummy INLINE [ Country, Sales, Target USA, 10000, 8500 UK, 7000, 9500 Germany, 5000, 4500 Japan, 6000, 6000 ];
We want to display the overall sales for the company and change the color of the bar based on the threshold value.
Dimensionless Bar Chart
and open it.Dummy
as shown:
=Valuelist('Dummy')
Sales
.Company Sales
as the chart Title under the General properties.If(Sum(Sales)>Sum(Target),RGB(0,255,0),RGB(255,0,0))
Qlik Sense doesn't allow dimensionless bar charts. So, we need to create a Dummy dimension that has only one single field value. Further when we select none under the labels and title option, it hides this field value from the axis, thus serving the purpose. The color code used for the bars will turn the bar red if the sales for a country are less than or equal to the target values:
We can use the
Dummy dimension directly from our source data instead of creating a master dimension in the frontend. Another approach is to use a calculated dimension =1
and name it Dummy
. All the approaches will yield the same result. To make the chart more informative one can add reference lines for the target.