Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
poluvidyasagar
Creator II
Creator II

Calculate the Chart expression value based on input value

Hi all,

I am trying to calculate productivity of the manpower based on shift using bar chart. However, i would like use to input box to input the number of people in each shift.

Example:

Data: 

PartShiftEvent
A1Finished
B1Finished
C1Finished
D1Finished
E2Finished
F2Finished
G2Finished
H2Finished
I 2Finished
J2Finished

Input Box Variables:

VariablesVariable Value
Number of 1st shift people 5
Number of 2nd shift people3

So,

Productivity of 1st shift people based on finished event time = 3/5 (number of finished events/number of people in 1st shift)

Productivity of 2nd shift people based on finished event time = 5/3 (number of finished events/number of people in 1st shift)

How do i calcuate this in expression because my number of people in shift changes everyday.


Thanks,

Vidya

11 Replies
adityaakshaya
Creator III
Creator III

Hi Vidya,


vNoOfPeopleShift1 = data coming from input box

vNoOfPeopleShift2 = data coming from input box


Productivity of 1 shift = count({<Event = {'Finished'},shift = {1}>}Part)/$(vNoOfPeopleShift1)

Productivity of 2 shift = count({<Event = {'Finished'},shift = {2}>}Part)/$(vNoOfPeopleShift2)


Regards,

Akshaya

poluvidyasagar
Creator II
Creator II
Author

Hi Akshay,

Can this be achieved in one single expression?  I want both expressions to be in one.

Thanks,

Vidya

adityaakshaya
Creator III
Creator III

Hi Vidya,

We can do it one expression but can you help me to understand the use case. If you can tell me what exactly be the end result for you, I can write in one.

Regards,

Akshaya

vishsaggi
Champion III
Champion III

How did you get Number 3 for 1st Shift people? I mean number of finished events based on data you provided?

poluvidyasagar
Creator II
Creator II
Author

Hi Akshay,

I want to display these results in one stacked bar chart showing productivity efficiency of the man power.

My dimensions  are Date, Shift (i did not include date in the example data i gave)

My Measure is Productivity Efficiency.

Here is Sample: (Ignore numbers)

Sample.png

Let me know if this makes sense.

Thanks,

Vidya

poluvidyasagar
Creator II
Creator II
Author

Hi Vishwarath,

Yes, it is the number of finished events for each shift.

Thanks,

Vidya

vishsaggi
Champion III
Champion III

We need more data to work on. can you share a sample file to look into?

poluvidyasagar
Creator II
Creator II
Author

Here is data:

    

PartDateEventShift
A5/3/2018Finished1
B5/3/2018Finished1
C5/3/2018Started1
D5/3/2018Finished2
E5/3/2018Finished2
F5/3/2018Finished2
G5/3/2018Finished2
H5/3/2018Finished2
I5/2/2018Started1
J5/2/2018Finished1
K5/2/2018Finished2
L5/2/2018Finished2
M5/2/2018Finished2
N5/1/2018Finished1
O5/1/2018Finished1
P5/1/2018Finished1
Q5/1/2018Finished2
R5/1/2018Finished2
S5/1/2018Finished2
T5/1/2018Finished2

Variables:

VariablesVariable Value
Number of 1st shift people5
Number of 2nd shift people3

Let me know if this helps

THanks,

Vidya

adityaakshaya
Creator III
Creator III

Hi Vidya,

Please find below the expression for your chart.

if(Shift = '1st',count({<Event = {'Finished'}>}Part)/$(vNoOfPeopleShift1),

     if(Shift = '2nd',count({<Event = {'Finished'}>}Part)/$(vNoOfPeopleShift2),

          count({<Event = {'Finished'}>}Part)/$(vNoOfPeopleShift3)))


Here above you have to create 3 variables for three shift

vNoOfPeopleShift1, vNoOfPeopleShift2, vNoOfPeopleShift3


Regards,

Akshaya


PS - If you find this response correct, mark it as correct.