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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
Anonymous
Not applicable

Grouping..

Hi there,

 

I am trying to use the 'countdistinct' function within Bi - which seems to work in some capacity, but the totals don't add up which is why I've tried to head down the grouping route. Whenever I group the data together, I lose sight of all remaining columns. 

 

I 'referenced/copied' my original data set, applied the grouping steps however when merging the 2 tables together my numbers don't add up. 

 

Example within the below excel data set being used, overall i'm looking to count the number of times a worker has clocked into a building but removing any duplication within the same date. 

 

E_D_1-1639737797780.png

 

Would be keen to get some thoughts - not sure if even heading down the grouping route will help?

 

I am relatively new to Bi 🙂 

 

Thanks.

1 ACCEPTED SOLUTION

@Anonymous 

In Power Query, select both the Date and the User Column pressing CTRL, right-click, choose Remove Duplicates. You will get rid of any duplicates within Date and User and retain all other columns as well.


Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

distinctcount calculated again for grand total

 

if you want sum you need to try like

 

sumx(values(Table[user]), distinctcount(Table[Where]))

 

User or department is grouping used in visual

 

Grand total - https://www.youtube.com/watch?v=ufHOOLdi_jk

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks for the message, I gave your SUM a try but I think the issue is that I am reverting to a date field to support my question.

 

Original Q:

To count the number of times a worker has clocked into a building, but removing any duplication within the same date. 

 

Sample Data (within Excel):

E_D_0-1639743809012.png

 

Desired Outcome (as illustrated within Excel):

E_D_1-1639743857922.png

 

Current view within PowerBi using the 'Grouping Function' along with the 'CountDistinct' against 'User' which gives me the correct result, but the remaining columns are lost (User, Department, Where):

 

E_D_2-1639743958507.png

 

I followed this tutorial to achieve the above for context:

https://www.youtube.com/watch?v=7l4dYEjmgqA 

 

Is there a way to tie in my original columns sets, so I can apply drill downs as required? 

 

@Anonymous 

In Power Query, select both the Date and the User Column pressing CTRL, right-click, choose Remove Duplicates. You will get rid of any duplicates within Date and User and retain all other columns as well.


Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

This works! Thank you so much!

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.