Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
fabdulazeez
Partner - Creator III
Partner - Creator III

Scatter plot color by dimension not working as expected

Hi,

I am encountering an problem with the scatter plot where the data is not being colored as anticipated. I am confident that the issue does not lie with the chart itself but rather with the data. However, I am uncertain about the steps I should take to debug this issue.

Below is the data when I plot it in a table 

fabdulazeez_0-1706853953472.png

Here crowd category calculated master dimension. When I convert the aforementioned data to a scatter plot and designate the color based on the dimension (crowd category), I am unable to visualize the "crowded" category as expected.

fabdulazeez_1-1706854151617.png

 

Qlik sense Version : November 2022

14.97.3

 

Crowd Category is defined as below

={<$(vLatest)>}if (
Aggr(Sum(queueLength),AREA_KEY,AreaName,AreaCapacity) > Aggr(Max(AreaCapacity),AREA_KEY,AreaName,AreaCapacity) ,'Crowded',
if (
Aggr(Sum(queueLength),AREA_KEY,AreaName,AreaCapacity) < Aggr(Sum(AreaNearCapacity),AREA_KEY,AreaName,AreaCapacity) ,'NotCrowded',
'NearCapacity'))

 

 

 

Labels (2)
1 Reply
LRuCelver
Partner - Creator III
Partner - Creator III

You aggregate within the if. To create a dimension from it, you should have it the other way around.

Here are my results, the data used and the code for the master dimension.

LRuCelver_0-1706874196747.png

Data:
NoConcatenate Load RowNo() as AREA_KEY, * Inline [
AreaName,Area Capacity,AreaNearCapacity,Queue Length
Departure Security,90,60,40
Departure Emigration,80,50,112
Check in zones,50,35,95
Transfer Security,50,35,64
Self Service Bag Drop,30,20,22
];
=Aggr(
    If(Sum([Queue Length]) <= Only([Area Capacity]),
        If(Sum([Queue Length]) <= Only([AreaNearCapacity]),
            'NotCrowded',
            'NearCapacity'
        ),
        'Crowded'
    ), 
    AREA_KEY
)

I only aggregate based on the AREA_KEY. I assumed the key is a unique identifier which makes the other fields redundant.