Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have a dataset like below:
Activities | |
User | Date |
A | 1/1/2021 |
B | 1/3/2021 |
C | 1/5/2021 |
D | 1/8/2021 |
E | 2/3/2021 |
Contacts | |
User | Date |
A | 1/1/2021 |
B | 1/4/2021 |
C | 1/5/2021 |
E | 1/18/2021 |
F | 2/1/2021 |
A | 2/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 | |
User | Category |
A | ABC |
B | ABC |
C | SDF |
D | ERT |
E | ERT |
F | QWE |
Data relations:
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 Months | Jan | Fer |
A | 1 | 1 |
B | 1 | 0 |
C | 1 | 0 |
D | 1 | 0 |
E | 0 | 1 |
F | 0 | 1 |
#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
Solved! Go to Solution.
// 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]
// 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]
User | Count |
---|---|
25 | |
12 | |
8 | |
7 | |
7 |
User | Count |
---|---|
27 | |
12 | |
11 | |
10 | |
6 |