Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
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
Luminary Alumni
Luminary Alumni

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
Luminary Alumni
Luminary Alumni

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
Luminary Alumni
Luminary Alumni

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