Forum Discussion

FrederikB's avatar
FrederikB
Frequent Visitor
4 years ago
Solved

Count unique values in other table

I have a table called bookings, and a table called persons. I want to calculate how many different persons have gotten a booking within some time interval. Bookings: id Date personId 1 01-...
  • serpiva64's avatar
    4 years ago

    Hi,

    you have confused the two Table.

     

    If this post is useful to help you to solve your issue consider giving the post a thumbs up 

     and accepting it as a solution !

     

     

  • v-yingjl's avatar
    v-yingjl
    4 years ago

    Hi FrederikB ,

    You can create measures like this to get the result:

    total bookings = DISTINCTCOUNT('bookings'[id])
    Persons with bookings = 
    VAR tab =
        SUMMARIZE (
            'bookings',
            'bookings'[personId],
            "total bookings", [total bookings]
        )
    RETURN
        COUNTX ( tab, [personId] )

     

    Best Regards,
    Community Support Team _ Yingjie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.