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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

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
v-yiruan-msft
Community Support
Community Support

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

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
v-yiruan-msft
Community Support
Community Support

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

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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
Super User
Super User

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors