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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
CA8172
Helper I
Helper I

Need a Count on Distinct Information

I am trying to create a Measure or a Column that will count the distinct information either based on an account number or first/last name.  I tried COUNTROWS, I tired DISTINCT, and even 'Grouped By', but not having success.  So either I am missing something or I don't know the easiest way to do this.  Below is the data that I have ...

 

ss004.png


For those that are highlighted yellow, I would like the next column to contain a 2, 3 or 4. For those in white, those would only be 1.

 

Any assistance on how I can establish this information, would greatly be appreciated.

 

Thanks!

7 REPLIES 7
Nathaniel_C
Community Champion
Community Champion


Hi @CA8172 , try this:

Measure = CALCULATE(COUNTROWS(myTable),ALLEXCEPT(myTable,myTable[Account Number]))

 
Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@Nathaniel_C  - I did as you suggested (see below), but it counted each row and is showing 21,912 for each Case Number, etc (see screen shot) when I try to put it all in a Table visualization.

 

PRODUCTS = CALCULATE(COUNTROWS(TableA),ALLEXCEPT(TableA,TableA[Account Number]))
 
ss005.png
Anonymous
Not applicable

@CA8172 

 

It is filtered with account number, if you drag account number column to the table it should be clear.
If you want to countrows for each Case Number(Request Id) you need to change the "ALLEXCEPT" function to ALLEXCEPT(TableA,TableA[Case Number])).

Paul

Hi @CA8172 ,
Would you share a picture of your data model relationships?

Thanks,

Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@Nathaniel_C- it is only one table so there is no relationships at this point

ss006.png

Dummied PBIX 
Hi @CA8172 ,
So here is a pbix with dummied data, it is one table with a measure that is applied to a table. See if this gives you an idea.

Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




CA8172
Helper I
Helper I

Someone had asked about the logic, but might have figured it out since it appeared to be deleted.  However I will still respond.

 

And now looking at it, I forgot one column "Products".  So when a customer is interested in a product, they request it.  Which then creates a Case Number.  That is the only unique key that is different for similar customers.  So take for example Sam Spring, he has two cases, because he is interested/purchased two different products (ie: Sweater and Phone Charger).

 

I hope that clarifies the difference, since I forgot to include "Products" in the screen shot.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.