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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How to sum distinct values with different conditions

Hello Community -  I have a simple table whereby I want to count the distinct count of Order #'s that are late, and the distinct count of Order #'s that are on time.    For example, ABC-23 has two lines, but of course is just one order # so I only want to count it once.   

 

 

texmexdragon_0-1632221804549.png

 

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

Hi, @Anonymous 

 

According to your description, I think you can create two measures.

Like this:

OnTime = COUNTX(FILTER(SUMMARIZE('Table',[Order],'Table'[Punctuality]),[Punctuality]="On Time"),[Punctuality])
Late = COUNTX(FILTER(SUMMARIZE('Table',[Order],'Table'[Punctuality]),[Punctuality]="Late"),[Punctuality])

 

vjaneygmsft_0-1632469866731.png

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.


Best Regards,

Community Support Team _ Janey

View solution in original post

3 REPLIES 3
v-janeyg-msft
Community Support
Community Support

Hi, @Anonymous 

 

According to your description, I think you can create two measures.

Like this:

OnTime = COUNTX(FILTER(SUMMARIZE('Table',[Order],'Table'[Punctuality]),[Punctuality]="On Time"),[Punctuality])
Late = COUNTX(FILTER(SUMMARIZE('Table',[Order],'Table'[Punctuality]),[Punctuality]="Late"),[Punctuality])

 

vjaneygmsft_0-1632469866731.png

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.


Best Regards,

Community Support Team _ Janey

amitchandak
Super User
Super User

@Anonymous , A measure like

 

calculate(distinctcount(Table[Order ID]), filter(Table, Table[Punctuality] = "Late"))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak      This unfortunate is not giving me the result I need.  For example, if I create two measures, based on your measure  (one for late, one for on time), and if I have multiple Orders selected in my filter, this is what I get.    What I need is the total sum, by category (On Time or Late) of the Orders that fall into either of those categories.    So, if there were 5 orders selected, two of them were late, and 3 on time, that should be reflected here.  

 

texmexdragon_0-1632223713962.png

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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