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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

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
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.