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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
SachinC
Helper V
Helper V

Count (Distinct) Totals not working

Hi there,

I have a couple of Power BI reports where my Count Distinct Totals aren't working.

See screenshots below.  If I don't apply Distinct, the totals are fine. Please help?

Thank you.

 

zzzdistinct_count.JPGzzzdistinct_count2.JPG

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi

Look at my test

This is my dataset

1.png

Then add these columns to a table visual

2.png

The second column is "count" of "refer", the third is "distinct count" of "refer", to get what you want:

each line should be distinct count, but the total should be the total of count, just like the last column.

it is a measure 

distinctount = IF(HASONEVALUE(Sheet1[name]),DISTINCTCOUNT(Sheet1[refer]),COUNT(Sheet1[refer]))

 

Best Regards

Maggie

View solution in original post

4 REPLIES 4
v-juanli-msft
Community Support
Community Support

Hi

Look at my test

This is my dataset

1.png

Then add these columns to a table visual

2.png

The second column is "count" of "refer", the third is "distinct count" of "refer", to get what you want:

each line should be distinct count, but the total should be the total of count, just like the last column.

it is a measure 

distinctount = IF(HASONEVALUE(Sheet1[name]),DISTINCTCOUNT(Sheet1[refer]),COUNT(Sheet1[refer]))

 

Best Regards

Maggie

prateekraina
Memorable Member
Memorable Member

Hi @SachinC,

 

Can you please tell what is the expected value as per your logic in Total?

Have you defined any measure for this? If yes, please share the expression.

 

Giving an example would be helpful.

For Example, Give some sample data and tell what do you expect out of it and what you are currently getting.

 

Prateek Raina

Hi,

I would have expected a Total based on the values I can see on a line-by-line basis.

I am bringing into the Table view, Name (text) which is the 2nd column in the screenshot and Count of Reference (which is also Text) in the 3rd column in screenshot. Is this why it's not working - I have text fields?

 

zzzdistinct_count3.JPG

Hi @SachinC,

 

The results which you are getting is correct. I think you are confused between count and distinct count.

Take a look at below picture to understand what is happening. I have used some dummy data:

Capture.PNG

 

I hope you get why the totals are like that in your case.

Here is the pbix of above in case you want to dig in more.

 

Prateek Raina

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors