Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Avg

Hi Experts,

I am using expression to show total no. of employees joined as like below

" Sum({<Date={'>=$(=MonthStart(Max(Month), -2))<=$(=MonthEnd(Max(Month)))'}>}Employee).

How to write expression for Avg Employees Joined for Month?

Thanks

1 Solution

Accepted Solutions
jagan
Partner - Champion III
Partner - Champion III

Then if you have a Calendar table then add one column like below

Calendar:

LOAD

*,

Day(MonthEnd(DateFieldName)) AS DaysInMonth

FROM DataSource;

Now in your expression use like below

=Sum({<Date={'>=$(=MonthStart(Max(Month), -2))<=$(=MonthEnd(Max(Month)))'}>}Employee)/Only({<Date={'>=$(=MonthStart(Max(Month), -2))<=$(=MonthEnd(Max(Month)))'}>}DaysInMonth)


Hope this helps you.


Regards,

jagan.

View solution in original post

4 Replies
jagan
Partner - Champion III
Partner - Champion III

HI,

Do you want Average employees per month?  In your set analysis expression you took for 3 months so if you divide it by 3 then you will get the monthly average.

=Sum({<Date={'>=$(=MonthStart(Max(Month), -2))<=$(=MonthEnd(Max(Month)))'}>}Employee)/3


If this is not you are looking then come up with some sample numbers and your expected output.


Regards,

Jagan.

Not applicable
Author

I want to show daily average for month

jagan
Partner - Champion III
Partner - Champion III

Then if you have a Calendar table then add one column like below

Calendar:

LOAD

*,

Day(MonthEnd(DateFieldName)) AS DaysInMonth

FROM DataSource;

Now in your expression use like below

=Sum({<Date={'>=$(=MonthStart(Max(Month), -2))<=$(=MonthEnd(Max(Month)))'}>}Employee)/Only({<Date={'>=$(=MonthStart(Max(Month), -2))<=$(=MonthEnd(Max(Month)))'}>}DaysInMonth)


Hope this helps you.


Regards,

jagan.

Not applicable
Author

Its Working