Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Measure for counting unique users grouped by a parameter

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 th...
  • v-yalanwu-msft's avatar
    4 years ago

    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.