Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2023, a live, in-person thrill ride. April 17 - 20, 2023, in Las Vegas! REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
kanalavs
Contributor
Contributor

Rank in the bar chart

Hi Friends,

I am new to the community. I have the requirement to display bar chart based on highest priority.

If a person has priority 1 and 2 then we need to consider the priority based on the latest date.

Please help how to write the rank script for the bar chart. You can find the data below.

 

FruitPerson NoRankDate
AppleSXXXX1120180718
AppleSXXXX2120180925
AppleSXXXX3120181119
AppleSXXXX4120180625
AppleSXXXX4120181016
AppleSXXXX5120180108
AppleSXXXX6120180815
AppleSXXXX7120180813
AppleSXXXX7120180814
OrangeSXXXX1220180718
OrangeSXXXX6220180815
BananaSXXXX2320180925
BananaSXXXX6320180815
GrapeSXXXX1520180718
BananaSXXXX3320181026
GrapeSXXXX5520171124
OrangeSXXXX5220180101

 

Attached Sample of the chart:

 

11 Replies
shiveshsingh
Master
Master

Hi

 

What do  you mean by priority here? How are you defining  it?

kanalavs
Contributor
Contributor
Author

Priority is defined in backend load by considering Apple priority-1, Orange-2, Banana-3, Grape-5.

we have to display the chart by displaying the number of persons tagged for the fruit name based on the rank.

If a person is tagged both apple and Orange then the chart has to consider the person id only for apple as apple is priority-1.

Please let me know if you need any other info.

uacg0009
Partner - Specialist
Partner - Specialist

Hi Kanalavs,

To be honest, I didn't get the real result that you want.

So could you please tell me what's the result you want according to the data you gave above?

Thanks

Aiolos Zhao

shiveshsingh
Master
Master

Hi

Couldn't get the logic 😞

kanalavs
Contributor
Contributor
Author

Hi Aiolos Zhao,

I have fields as follows:

Action- outcome action

C-ID-Person number

Rank-rank (pre-defined as (CA : 1, DA :2, WA : 3, NA : 5)

Date: Created Date

Requirement: Need to count the number of persons for each Action item based on the rank.

rank1 is the highest. If a person tagged to rank 1 and rank2 then we need to count the person tagged to rank1 and ignore the count for rank2.

Please see the below outcome results based on the aggr function that I defined:

highest priority CA is mapped to 18 persons but few of the persons are also tagged to DA, WA, NA, please see pic2. Based on the requirements, i need to ignore lower rank DA,WA,NA for those repeated persons and consider only CA.

pic1:

[Action]aggr(count([C_ID]),RANK,[Action])
CA18
DA2
WA2
NA1

 

Pic2:

Action[C_ID]
CAPNXXX1
CAPNXXX2
CAPNXXX3
CAPNXXX4
CAPNXXX5
CAPNXXX6
CAPNXXX7
CAPNXXX8
CAPNXXX9
CAPNXXX10
CAPNXXX11
CAPNXXX12
CAPNXXX13
CAPNXXX14
CAPNXXX15
CAPNXXX16
CAPNXXX17
CAPNXXX18
DAPNXXX7
DAPNXXX15
WAPNXXX11
WAPNXXX15
NAPNXXX7

 

uacg0009
Partner - Specialist
Partner - Specialist

Hi,

So the result you expect is below table?

[Action]Num
CA18
DA0
WA0
NA0

 

am I right? if not, please show your expect result.

Aiolos

kanalavs
Contributor
Contributor
Author

Hi Aiolos,

Yes, the output should be 

[Action]Num
CA18
DA0
WA0
NA0

 I tried aggr and firstsortedvalue functions but could not able to get the above result.

uacg0009
Partner - Specialist
Partner - Specialist

Hi Kanalavs,

I don't know whether you can left join a table in back-end,

I left join a rank table in back-end, and change the data source for testing the expression, 

I think below is what you want :

Rank in the bar chart.PNG

Aiolos Zhao

kanalavs
Contributor
Contributor
Author

Aiolos Zhao,

Backend, I did leave join and the outcome results should be as specified below. DA, WA, and NA should be 0 because the persons under these elements also belong to CA and CA is the high priority.

 

[Action]Num
CA18
DA0
WA0
NA