Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello Team,
I have to find the DAX Query or Measure for unique users per day based on the below python code,
events_per_user_per_day = all_events.groupby([pd.Grouper(key='servertime', freq='D', label='left'), 'user'])[['appId']].count()
f = events_per_user_per_day.groupby(level="servertime").size().plot()
My SQL query is like below,
Hi @ssspk
Please try the following methods:
1: DAX Measure for Unique Users Per Day
If you want a measure that you can use in visuals to dynamically calculate unique users per day based on the current filter context, use the following DAX measure:
Unique Users Per Day =
COUNTROWS(
SUMMARIZE(
'data',
'data'[servertime],
'data'[user]
)
)
This measure counts the unique combinations of `servertime` and `user`, effectively giving you the number of unique users per day. It's worth noting that the `servertime` column should be a date or datetime type. If `servertime` includes times, you might need to convert it to a date-only format within the measure, like so:
Unique Users Per Day =
COUNTROWS(
SUMMARIZE(
'data',
DATEVALUE('data'[servertime]),
'data'[user]
)
)
2: Calculated Table for Unique Users Per Day
If your goal is to create a calculated table that lists each day with the count of unique users for that day, you can use the following DAX expression:
Unique Users Per Day Table =
SUMMARIZE(
'data',
DATEVALUE('data'[servertime]),
"UniqueUsers", DISTINCTCOUNT('data'[user])
)
This calculated table will have two columns: one for the day and one for the count of unique users for each day ('UniqueUsers').
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
98 | |
91 | |
84 | |
73 | |
67 |
User | Count |
---|---|
115 | |
102 | |
98 | |
71 | |
66 |