Forum Discussion
Last 3 months data for user activities
Hi ,im trying to create a measure that calculate and visualize the number of activities(eg: creating policies) performed by user in last 3 months( month by month) and also in a same or another visual to show total count of last 3 months when username is selected.
| Date | Activity | username |
| 1/5/2022 | policy creation | DD |
| 21/5/2022 | policy creation | AA |
| 29/5/2022 | policy creation | AA |
| 6/6/2022 | policy creation | DD |
| 15/06/2022 | policy creation | DD |
| 28/6/2022 | policy creation | BB |
| 1/7/2022 | policy creation | CC |
| 10/7/2022 | policy creation | AA |
| 20/07/2022 | policy creation | JJ |
Output:
| Date | Username | count of activity |
| May-2022 | DD | 1 |
| May-2022 | AA | 2 |
| Jun-2022 | DD | 2 |
| Jun-2022 | BB | 1 |
| Jul-2022 | CC | 1 |
| Jul-2022 | AA | 1 |
| Jul-2022 | JJ | 1 |
| Total | 9 |
Hi Anonymous ,
Is your data coming from the same table? In my example data the measure returns the correct result.
Measure = VAR currentmonth = EOMONTH ( MAXX ( ALLSELECTED ( 'Table' ), 'Table'[Date] ), 0 ) RETURN CALCULATE ( COUNT ( 'Table'[Activity] ), FILTER ( 'Table', 'Table'[Date] > EDATE ( currentmonth, -3 ) && 'Table'[Date] <= currentmonth ) )If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- amitchandak
Super User
Anonymous , Create a measure like this and use in visual
Last 3 Months Today =
var _min = eomonth(today(),-3)+1
var _max = eomonth(today(),0)
returnCALCULATE(countrows(Table) , FILTER('Table','Table'[Date] >=_min && 'Table'[Date] <= _max))
- AnonymousNot applicable
amitchandak - This calculates and provides the total count but not the count of activites of users performed in the specific month (third column).
any help is appreciated .
p.s. basically on the x axis the user names to be displayed and on yaxis the count of activities that they have done in the individual months
- v-kkf-msft
Community Support
Hi Anonymous ,
Is your data coming from the same table? In my example data the measure returns the correct result.
Measure = VAR currentmonth = EOMONTH ( MAXX ( ALLSELECTED ( 'Table' ), 'Table'[Date] ), 0 ) RETURN CALCULATE ( COUNT ( 'Table'[Activity] ), FILTER ( 'Table', 'Table'[Date] > EDATE ( currentmonth, -3 ) && 'Table'[Date] <= currentmonth ) )If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. - v-kkf-msft
Community Support
Hi Anonymous ,
Has your problem been solved? If it is solved, please mark a reply which is helpful to you.
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz