Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
sparker22
Frequent Visitor

Distinct count across all categories, not just within each

Hi,

I am looking to create demographic breakdown of individuals, however Distinct Count isn't working as I need for returning users whose category changes.

I want all categories to equal the total number of unique users, rather than the total of unique users in each age

User#Age
118
219
323
427
219
517
623
119

 

Because user#1's age changes, this will get counted once in both the 18 and 19 age category, rather than only once as I need because the user# is the same.

 

Any thoughts?

1 ACCEPTED SOLUTION

@sparker22 , If I am took your question correctly then you can try:-

Measure 3 = 
CALCULATE (
    DISTINCTCOUNT ( 'Table (3)'[User#] ),
    All ('Table (3)'[Age] )
)

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

4 REPLIES 4
Samarth_18
Community Champion
Community Champion

Hi @sparker22 ,

 

Create a concatenated column as below and take a distinct count of it:-

Column = [User#]&"-"&[Age]

Samarth_18_1-1649416710030.png

 

Measure = distinctcount(table[column])

 

Thanks,

Samarth

 

  

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Thanks for your response Samarth.

 

I believe this has the same issue.

As it stands there are 6 distinct users

If we get the distinct count of each age, user 1 will be counted twice, in both the 18 and 19 ages. I would like them to be only counted once

@sparker22 , If I am took your question correctly then you can try:-

Measure 3 = 
CALCULATE (
    DISTINCTCOUNT ( 'Table (3)'[User#] ),
    All ('Table (3)'[Age] )
)

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Jihwan_Kim
Super User
Super User

Hi,

I am not sure which visualization you want to use to display your information, but please try the below.

 

expected outcome measure: =
CALCULATE (
    DISTINCTCOUNT ( TableName[User#] ),
    REMOVEFILTERS ( TableName[Age] )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors