Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
nezuko_kamado
Creator
Creator

How to get the bar chart variable factors changed by filter selection ( GetFieldSelections())?

I'm trying to create a bar chart that changes variable factors by filter selections.

With ID of A, B, and C, I want to compare two selected factors' sum

like  A&B sum by date,   A&C sum by date , or B&C sum by date as below.

barchart.PNG 

But the first issue I'm facing is sum({$<ID={'$(GetFieldSelections(ID))'}>} Unit) does not bring sum unit into the graph, even though KPI shows the selected factor. 

barchart2.PNG

 

Then the second issue is that how can I apply two selections into that one bar chart? barchart3.PNG

 

data is as below.

original:
load * inline [ Date, Week, ID, Unit
9/1/2021, 1, A, 1
9/1/2021, 1, A, 2
9/2/2021, 1, A, 1
9/2/2021, 1, A, 2
9/2/2021, 1, C, 2
9/3/2021, 1, A, 1
9/4/2021, 1, A, 2
9/5/2021, 1, A, 2
9/6/2021, 1, A, 2
9/7/2021, 2, A, 3
9/9/2021, 2, A, 3
9/9/2021, 2, A, 3
9/9/2021, 2, C, 3
9/3/2021, 1, B, 1
9/4/2021, 1, B, 2
9/5/2021, 1, B, 2
9/6/2021, 1, B, 2
9/7/2021, 2, B, 3
9/7/2021, 2, B, 5
9/7/2021, 2, C, 5
9/9/2021, 2, B, 3
9/10/2021, 2, A, 3
9/14/2021, 3, A, 2
9/10/2021, 2, B, 3
9/11/2021, 3, B, 2
9/12/2021, 3, B, 2
9/13/2021, 3, B, 2
9/13/2021, 3, B, 4
9/14/2021, 3, B, 2
9/27/2021, 5, A, 2
9/28/2021, 5, A, 5
9/15/2021, 3, B, 2
9/15/2021, 3, B, 3
9/16/2021, 3, B, 2
];

Labels (2)
2 Replies
PrashantSangle

user double quote and = to evaluate your expression within set analysis like

sum({$<ID={"$(=GetFieldSelections(ID))"}>} Unit) 

 

also try with concat()

 

Regards,

Prashant Sangle

 

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
nezuko_kamado
Creator
Creator
Author

Great it works! And could you help me for the second question please?

So, how can I make two selections of IDs compose two bars side by side? something like,  GetFieldSelections(ID)[1] goes to the first graph, and GetFieldSelections(ID)[2] goes to the second graph.

So that I can comepare like  A&B.   A&C, or B&C  side by side from graphs. Is this possible?

Thank you so much.