Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
eva_maria
Contributor III
Contributor III

avg expression

Hi!

I'm trying to calculate the number of employees (num) in each position (pto), Empl OK  in my table but I only get Empl (number of total employees)

     

YearNumPtoEmpl (count(total <Pto> Num))Empl OK
20171com142
20172com142
20173com341
20174com241

How can i do it?

Regards

1 Solution

Accepted Solutions
sunny_talwar

Wow, you made it really complex... try thisCapture.PNG

Dimension

Year

Num

Pto

Expression

Count({$<Year={$(=(Year)-1)}>} TOTAL <Pto> Num)



View solution in original post

10 Replies
sunny_talwar

Do you have Pto as one of the dimensions? If not, may be try this

Aggr(NODISTINCT Count(Num), Year, Pto)

eva_maria
Contributor III
Contributor III
Author

Sunny, thanks for your qick reply,

Pto is included as chart expression and year is a calculated dimension

I have used your expression, the result is (Empl colum)

Year

Num

Pto

Empl

Empl OK

2017

1

com1

2

2

2017

2

com1

1

2

2017

3

com3

1

1

2017

4

com2

2

1

sunny_talwar

Why don't you add Pto as a dimension... and then your original expression ( Count(total <Pto> Num) ) should work

eva_maria
Contributor III
Contributor III
Author

Please, see my attached file.

sunny_talwar

Wow, you made it really complex... try thisCapture.PNG

Dimension

Year

Num

Pto

Expression

Count({$<Year={$(=(Year)-1)}>} TOTAL <Pto> Num)



eva_maria
Contributor III
Contributor III
Author

Sunny, no way i can match the results in your link.

Any other opcion??

sunny_talwar

What do you mean Eva? I am not sure I understand

eva_maria
Contributor III
Contributor III
Author

Hi,

I think it can't be done with Num as a dimension, so i have removed it and that's what i get

Thank you for your patience and interest in helping.

Regards

sunny_talwar

But did I just not show you how this can be done?

Capture.PNG

What is wrong with this?