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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Syndicate_Admin
Administrator
Administrator

Count repeated values only once

I have a table as shown in the image with opportunity codes that are unique and do not repeat and I also have a column that is the ID_Cliente that can be repeated several times.

I want to get a calculated column that puts me "1" for each id_cliente counted only 1 time, but it is counting me only the only ones with this DAX formula

CALCULATE(DISTINCTCOUNT(Opportunities[codOpportunity]),ALLEXCEPT(Opportunities, Opportunities[CustomerID]))

I want you to tell me both the only ones that are not repeated, as well as the repeated but counted only 1 time. So the table would look as shown in the image. I appreciate any ideas or help.

KheyGlezM85_0-1679418723314.png

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @Syndicate_Admin ,
Update your counting formula for :

Column =
if(CALCULATE ( COUNT ( 'Table'[id] ), ALLEXCEPT ( 'Table','Table'[id] ) )=1,1,blank())
*Whithout "if" it will just count repeats of every "id".
Ritaf1983_0-1679457179956.png

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



Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

Hi Could you help me with this request, I'm trying to place this formula, if(CALCULATE ( COUNT ( 'Table'[id] ), ALL except ( 'Table','Table'[id] ) )=1,1,blank()), but I can't find the count function and the third criterion of the if function (i.e. the blank one) doesn't work.

Ritaf1983
Super User
Super User

Hi @Syndicate_Admin ,
Update your counting formula for :

Column =
if(CALCULATE ( COUNT ( 'Table'[id] ), ALLEXCEPT ( 'Table','Table'[id] ) )=1,1,blank())
*Whithout "if" it will just count repeats of every "id".
Ritaf1983_0-1679457179956.png

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



Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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