Forum Discussion
Anonymous
8 years agoNot applicable
Average of users
I want to make average of users per month. Count of users are distinct each month. But I want my average should look like: for the first two months (173+308)/2 or for three months (173+308+382...
- 8 years ago
Anonymous
What about this one? :smileytongue:
Average User Count by month = IF ( HASONEVALUE ( 'Talend_GA sessions'[Month] ), AVERAGEX ( FILTER ( ALLSELECTED ( 'Talend_GA sessions'[Month] ), 'Talend_GA sessions'[Month] <= SELECTEDVALUE ( 'Talend_GA sessions'[Month] ) ), CALCULATE ( DISTINCTCOUNT ( 'public accounts_usersession'[user_id] ) ) ), DIVIDE ( AVERAGEX ( ALL ( 'Talend_GA sessions'[Month] ), CALCULATE ( DISTINCTCOUNT ( 'public accounts_usersession'[user_id] ) ) ), DISTINCTCOUNT ( 'Talend_GA sessions'[Month] ) ) )
Anonymous
8 years agoNot applicable
Hi Zubair_Muhammad,
Thank you for your solution. It's works great. But I have one more question why in the Total it showing the distinct count of whole year divided by 12.
It should show me the sum of all the values here in the table divided by 12.
Or, Am I missing something here ?
Zubair_Muhammad
Community Champion
8 years agoAnonymous
Actually i didn't touch the second argument of IF.
Check this one. I just added CALCULATE highlighted in red font below
Average User Count by month =
IF (
HASONEVALUE ( 'Talend_GA sessions'[Month] ),
AVERAGEX (
FILTER (
ALLSELECTED ( 'Talend_GA sessions'[Month] ),
'Talend_GA sessions'[Month] <= SELECTEDVALUE ( 'Talend_GA sessions'[Month] )
),
CALCULATE ( DISTINCTCOUNT ( 'public accounts_usersession'[user_id] ) )
),
DIVIDE (
AVERAGEX (
'public accounts_usersession',
CALCULATE ( DISTINCTCOUNT ( 'public accounts_usersession'[user_id] ) )
),
DISTINCTCOUNT ( 'Talend_GA sessions'[Month] )
)
)- Anonymous8 years agoNot applicable
Now, I am getting some strange value in the total.
- Zubair_Muhammad8 years ago
Community Champion
Anonymous
What about this one? :smileytongue:
Average User Count by month = IF ( HASONEVALUE ( 'Talend_GA sessions'[Month] ), AVERAGEX ( FILTER ( ALLSELECTED ( 'Talend_GA sessions'[Month] ), 'Talend_GA sessions'[Month] <= SELECTEDVALUE ( 'Talend_GA sessions'[Month] ) ), CALCULATE ( DISTINCTCOUNT ( 'public accounts_usersession'[user_id] ) ) ), DIVIDE ( AVERAGEX ( ALL ( 'Talend_GA sessions'[Month] ), CALCULATE ( DISTINCTCOUNT ( 'public accounts_usersession'[user_id] ) ) ), DISTINCTCOUNT ( 'Talend_GA sessions'[Month] ) ) )- Anonymous8 years agoNot applicable
Now, It's still something strange. But no worries I can live with that. Thanks a lot for your help.