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

Suming a column based on unique value of another column

I have a table with policy number, and total members associated to that policy number.

Problem is, the policy number and total member count is duplicated because of other categories the data is split into.

An example of my data below. 

 

I need to sum Member Count, in DAX, but I want it to sum based on distinct values of Policy_Nbr. So in the below example my total should be 821 and not 1,334. Is this possible?

 

Policy_Nbr   Member_Count   Duration

8200201      144                       11

8200201      144                       10

8200201      144                       2

306AUS1     225                       7

306AUS1     225                       1

306EGY1      452                      1

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please check the below picture and the measure, whether it is what you are looking for.

 

Picture5.png

 

Members Count Distinct Policy Nr =
VAR distincttable =
GROUPBY (
Data,
Data[Policy_Nbr],
"@membercount", MAXX ( CURRENTGROUP (), Data[Member_Count] )
)
RETURN
SUMX ( distincttable, [@membercount] )

 

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

Linkedin: https://www.linkedin.com/in/jihwankim1975/


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

1 REPLY 1
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please check the below picture and the measure, whether it is what you are looking for.

 

Picture5.png

 

Members Count Distinct Policy Nr =
VAR distincttable =
GROUPBY (
Data,
Data[Policy_Nbr],
"@membercount", MAXX ( CURRENTGROUP (), Data[Member_Count] )
)
RETURN
SUMX ( distincttable, [@membercount] )

 

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

Linkedin: https://www.linkedin.com/in/jihwankim1975/


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

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.