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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

calculating active users over the months

I have a dataset like below:

Activities
UserDate
A1/1/2021
B1/3/2021
C1/5/2021
D1/8/2021
E2/3/2021

 

Contacts
UserDate
A1/1/2021
B1/4/2021
C1/5/2021
E1/18/2021
F2/1/2021
A2/9/2021

 

Calendar
Dates
1/1/2021
1/2/2021
1/3/2021
1/4/2021
1/5/2021
1/6/2021
1/7/2021
1/8/2021

 

Users
UserCategory
AABC
BABC
CSDF
DERT
EERT
FQWE

 

Data relations:

  • Users 1 to many Activities
  • Users 1 to many Contats
  • Calendar 1 to many Activities
  • Calendar 1 to many Contats

Active user: is a user who performed at least one activity (Activities or Contacts) during the month. And with that he should receive the 1 that month

Inactive User: is a user who has not performed any activity. And with that he should receive the 0 that month

This is the example of the results table I want:

Active User x MonthsJanFer
A11
B10
C10
D10
E01
F01


#Activities_Users = CALCULATE(DISTINCTCOUNT('Activities'[User]),USERELATIONSHIP('Activities'[Date],'Calendar'[Date]))

 

I already tried to create a measure to count the active users of one of the tables, however I don't know how to do to evaluate the 2 tables

1 ACCEPTED SOLUTION
daxer-almighty
Solution Sage
Solution Sage

// The Calendar table should be
// connected to both Contacts and
// Activities. No INACTIVE relationships
// should be present. Make sure that
// users are always selected from the
// Users dimension and time from Calendar.
// The fact tables should be hidden like
// Best Practices dictate. If you don't
// follow these, the formulas will not
// be working correctly.

[# Selected Users] = COUNTROWS( Users[User] )

[# Active Users] =
// An active user is one who
// in the selected period of
// time from Calendar has at
// least 1 entry in Activities or
// in Contacts.
COUNTROWS(
    DISTINCT(
        UNION(
            DISTINCT( Activities[User] ),
            DISTINCT( Contacts[User] )
        )
    )
)

[# Inactive Users] =
// In inactive user is one
// who has not been an active
// user in the selected period
// of time. In other words, subtract
// the active users from all the
// visible users in the current context.
[# Selected Users] - [# Active Users]

View solution in original post

1 REPLY 1
daxer-almighty
Solution Sage
Solution Sage

// The Calendar table should be
// connected to both Contacts and
// Activities. No INACTIVE relationships
// should be present. Make sure that
// users are always selected from the
// Users dimension and time from Calendar.
// The fact tables should be hidden like
// Best Practices dictate. If you don't
// follow these, the formulas will not
// be working correctly.

[# Selected Users] = COUNTROWS( Users[User] )

[# Active Users] =
// An active user is one who
// in the selected period of
// time from Calendar has at
// least 1 entry in Activities or
// in Contacts.
COUNTROWS(
    DISTINCT(
        UNION(
            DISTINCT( Activities[User] ),
            DISTINCT( Contacts[User] )
        )
    )
)

[# Inactive Users] =
// In inactive user is one
// who has not been an active
// user in the selected period
// of time. In other words, subtract
// the active users from all the
// visible users in the current context.
[# Selected Users] - [# Active Users]

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.