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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Averageif and max on period base

Hi all,

 

I have a dataset of users, one line per login and I am in need to:

 

  1. Compare the average of user's login of the last 6 months with the average users with the same department have (each line has mentioned the department.
  2. Compare the max of logins in the past 6 months with the logins of last month.

 

The current measures are:

 

Logins_per_user = DIVIDE(COUNT(PENDO_Visitors[Visitor ID]), DISTINCTCOUNT(PENDO_Visitors[Visitor ID]))

 

Total Logins Last 6 Months = 
CALCULATE (
   [Logins_per_user],
   DATESINPERIOD (
      'calendar'[Date],         
      MAX ( 'calendar'[Date] ), 
      -6,                
      MONTH                
    )
)

 

Average Logins Last 6 Months = [Total Logins Last 6 Months]/6

 

I can get the average per department just putting the Average Logins Last 6 Months next to the Department but how do I create those 2 measures?

2 REPLIES 2
Anonymous
Not applicable

Here an example, basically I need a measure like the one below so I can compare the average per department per month in the last 6 months (second table) with the average per user in the last 6 months (first table).

 

Andmi00_0-1666250633734.png

 

 

The max of logins of the last 6 months basically if user A had 2 logins in September, 3 in August, 1 in July, 1 in June, 1 in May, 4 in April should be 4 for that user.

 

 

An example of table could be 

User IDLogin DateDepartment
ABC122/4/2022Department 1
ABC126/4/2022Department 1
ABC130/4/2022Department 1
ABC116/8/2022Department 1
ABC117/8/2022Department 1
ABC117/7/2022Department 1
ABC118/9/2022Department 1
ABC215/4/2022Department 1
ABC225/5/2022Department 1
ABC213/6/2022Department 1
ABC311/6/2022Department 2
ABC326/8/2022Department 2
ABC3

27/8/2022

Department 2

ABC4

15/7/2022

Department 2

ABC4

19/7/2022

Department 2

ABC4

28/8/2022

Department 2

ABC5

16/9/2022

Department 3

 

Anonymous
Not applicable

Hi @Anonymous ,

In order to better understand your demands and give the right solution, could you please provide some more specific information? such as your desensitized example data and a screenshot of your desired results?

Thanks for your efforts & time in advance.

 

Best regards,
Community Support Team_ Binbin Yu

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors