Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Get the average per group for the last 6 months

Hi all, 

 

I have a table with one line for each user for each daily login, next to it I have the User ID and the Department.

Can someone help me with making a measure that calculates the average of logins per department per month? And then compare the user logins in the current month with the average of their department's logins of the previous 6 months?

 

I am attaching a pbix sample file of my dataset https://drive.google.com/file/d/1lgPt5CLsYpUQz6EmsjWreh9u0abQacjy/view?usp=sharing

4 REPLIES 4
Anonymous
Not applicable

@amitchandak Thank you but my answer was how to calculate the averages per department and then compare it against the single user, so for example, if department A had a Login average of 7 logins in the last 6 months, how does that compare against the logins for this month of a user part of Department A?

Hi @Anonymous ,

 

You can add EARLIER function in the filters of the CALCULATE function so that you can get each department's average of logins.

 

'Table'[department]=EARLIER( 'Table'[department])

 

The same to per user.

'Table'[User ID]=EARLIER( 'Table'[User ID])

 

Best Regards,
Community Support Team _ xiaosun

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@v-xiaosun-msft could you write down what would be the full formula? So I can calculate the user logins in the current month compared to the average of their department logins in the 6 months before.

amitchandak
Super User
Super User

@Anonymous , Example of 6 month average, with help from date table

 

12 Month Avg = CALCULATE(AverageX(Values('Date'[MONTH Year]),calculate(Count('Table'[User ID)))
,DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-12,MONTH))

 


To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.