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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. 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
Solution Sage
Solution Sage

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
Solution Sage
Solution Sage

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
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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