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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
lennox25
Post Patron
Post Patron

Measure for Distinct Count of number sold per ID

Here is my sample table. There are further columns which I have omitted but this is the reason there are duplicate rows per ID

What I need is a measure that tells me the (distinct) Total No Sold per ID.  The result for -748902 Store No 521 Date 02/12/2022 should be 200. At present when I use my measure to calculate its telling me 600 sold which is incorrect. I cant remove what here looks like duplicate rows as there are other columns that need to remain in this table.

lennox25_0-1730807323297.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @lennox25 ,

You can create a measure as below to get it, please find the details in the attachment.

Count of number sold = 
VAR _tab =
    SUMMARIZE ( 'Table', 'Table'[ID], 'Table'[Sold] )
RETURN
    SUMX ( _tab, [Sold] )

vyiruanmsft_0-1731484129766.png

Best Regards

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hi @lennox25 ,

You can create a measure as below to get it, please find the details in the attachment.

Count of number sold = 
VAR _tab =
    SUMMARIZE ( 'Table', 'Table'[ID], 'Table'[Sold] )
RETURN
    SUMX ( _tab, [Sold] )

vyiruanmsft_0-1731484129766.png

Best Regards

Ashish_Mathur
Super User
Super User

Hi,

Share data in a format that can be pasted in an MS Excel file.  Show the expected result very clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

Share data in a format that can be pasted in an MS Excel file.  Show the expected result very clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
PhilipTreacy
Super User
Super User

@lennox25 

 

It's always helpful to provide a sample of all the data we're working with.

 

So you have something like this, I've created a dummy column to represent the columns we can't see in your data

 

PhilipTreacy_0-1730854687943.png

You said you are using a measure called Sold Total and the image you supplied shows a column called Sold, not the measure.

 

If I add the Sold column into the table and change the aggregation to MIN

 

PhilipTreacy_1-1730854856253.png

 

Removing the dummy Value column gives this which I think is where you are having the issue with the measure

 

PhilipTreacy_2-1730854967417.png

 

But as you can see the MIN of Sold column gives the answer you want doesn't it?  So you can remove the measure from the table and use the MIN of Sold column.  Or am I missing something?  

 

Regards

 

Phil

 

 

 

 

 

 

 

 

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


FreemanZ
Community Champion
Community Champion

hi @lennox25 ,

 

besides the four fields, do you have other fields for the table visual?

PhilipTreacy
Super User
Super User

Hi @lennox25 

 

Change the aggregation for the Sold column from SUM to MIN or MAX.

 

Also, would help if you provided the DAX you're using for the measure.

 

PhilipTreacy_0-1730808350321.png

 

 

Regards

 

Phil

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


@PhilipTreacy That doesnt work for me.

The measure I am using is 

Sold total  = SUM('table'[sold])

Helpful resources

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