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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
ayush_mriti
Helper I
Helper I

Calculation to count only 1 for duplicate items

Hi All,

 

I have this logic to count only 1 for duplicate EMPLID. Right now its counting all the duplicates and the total is not correct.

 

ayush_mriti_0-1743706036661.png

 

In the above table, EMPLID which are highlighted needs to be counted only 1 so that the total count is 7 instead of 9. Is there a solution to get this. 

Here are the DAX calculations for SM+KL Totals: 

SM+KL total =
DISTINCTCOUNTNOBLANK('Employee Output final_Current'[KL_cnt]) + DISTINCTCOUNTNOBLANK('Employee Output final_Current'[Sm_cnt])
KL_cnt = IF(
    'Employee Output final_Current'[ATR_Role] =  "Kanban Lead(s)",
     'Employee Output final_Current'[EMPLID]
     )
Sm_cnt = IF(
       'Employee Output final_Current'[ATR_Role] =  "Scrum Master(s)",
     'Employee Output final_Current'[EMPLID]
     )
Thanks in Advance.
 
4 ACCEPTED SOLUTIONS
Cookistador
Memorable Member
Memorable Member

Hello @ayush_mriti 

The following code should return what you need

 

SM+KL Distinct Total =
CALCULATE(
DISTINCTCOUNT('Employee Output final_Current'[EMPLID]),
FILTER(
'Employee Output final_Current',
'Employee Output final_Current'[ATR_Role] = "Kanban Lead(s)" ||
'Employee Output final_Current'[ATR_Role] = "Scrum Master(s)"
)
)

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

Does this work?

Measure = calculate(DISTINCTCOUNTNOBLANK('Employee Output final_Current'[KL_cnt]) + DISTINCTCOUNTNOBLANK('Employee Output final_Current'[Sm_cnt]), ('Employee Output final_Current'[ATR_Role]="Kanban Lead(s)"||'Employee Output final_Current'[ATR_Role]="Scrum Master(s)"))


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

View solution in original post

its giving me the count of 14 instead of 7.

View solution in original post

its giving me the count of 14 instead of 7.

View solution in original post

5 REPLIES 5
ayush_mriti
Helper I
Helper I

The solution worked, I just have to make some adjustment to the calculation. Thank you all.

Ashish_Mathur
Super User
Super User

Hi,

Does this work?

Measure = calculate(DISTINCTCOUNTNOBLANK('Employee Output final_Current'[KL_cnt]) + DISTINCTCOUNTNOBLANK('Employee Output final_Current'[Sm_cnt]), ('Employee Output final_Current'[ATR_Role]="Kanban Lead(s)"||'Employee Output final_Current'[ATR_Role]="Scrum Master(s)"))


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

its giving me the count of 14 instead of 7.

Cookistador
Memorable Member
Memorable Member

Hello @ayush_mriti 

The following code should return what you need

 

SM+KL Distinct Total =
CALCULATE(
DISTINCTCOUNT('Employee Output final_Current'[EMPLID]),
FILTER(
'Employee Output final_Current',
'Employee Output final_Current'[ATR_Role] = "Kanban Lead(s)" ||
'Employee Output final_Current'[ATR_Role] = "Scrum Master(s)"
)
)

its giving me the count of 14 instead of 7.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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