Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi there!
Consider a table of facts. Each record contains user_id and some flag (true/false). I need to count unique users according to that flag and visualize it like a bar. For instance imagine that there're 10 users (10 records) with flag = "false" - (0, 10). After appending 2 records (12 records in total) where flag = "true" we get (2, 8), but not (2, 10). I came up with this measure which is as straight as possible, but gives no grouping at all.
unique_users =
VAR users_true = CALCULATETABLE(
DISTINCT(users[user_id]),
users[flag] = "true"
)
VAR users_false = CALCULATETABLE(
DISTINCT(users[user_id])
)
RETURN SWITCH(
TRUE(),
"true" IN flags, COUNTROWS(users_true),
COUNTROWS(users_false) - COUNTROWS(users_true)
)
Thank you beforehand and best regards!
Solved! Go to Solution.
Hi, @Anonymous ;
Try it.
unique_users =
VAR users_true =
SUMMARIZE(FILTER('users', users[flag] = "true" ),[user_id])
VAR users_false =
SUMMARIZE('users',[user_id])
RETURN
COUNTROWS ( users_false ) - COUNTROWS ( users_true )
The final output is shown below:
Sorry I can't reproduce your data model, if this formula does not apply to your model, can you share simple files or scenarios?
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous ;
Try it.
unique_users =
VAR users_true =
SUMMARIZE(FILTER('users', users[flag] = "true" ),[user_id])
VAR users_false =
SUMMARIZE('users',[user_id])
RETURN
COUNTROWS ( users_false ) - COUNTROWS ( users_true )
The final output is shown below:
Sorry I can't reproduce your data model, if this formula does not apply to your model, can you share simple files or scenarios?
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 38 | |
| 37 | |
| 28 | |
| 28 |
| User | Count |
|---|---|
| 124 | |
| 89 | |
| 73 | |
| 66 | |
| 65 |