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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
bml123
Post Patron
Post Patron

Sum of distinct values for each customer id

I have data like this and I and I want the output as in Total column where it should sum only the distinct values from amount for each id.  How do I achieve this?

 

IdAmountTotal
11030
11030
12030
11030
22050
22050
23050
22050
22050
23050
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @bml123 

Please check the below picture and the formula for creating a new column.

 

Picture3.png

 

Total CC =
VAR currentid = 'Table'[Id]
VAR distinctamount =
FILTER (
SUMMARIZE ( 'Table', 'Table'[Id], 'Table'[Amount] ),
'Table'[Id] = currentid
)
RETURN
SUMX ( distinctamount, 'Table'[Amount] )
 
 

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: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

 

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Hi, @bml123 

Please check the below picture and the formula for creating a new column.

 

Picture3.png

 

Total CC =
VAR currentid = 'Table'[Id]
VAR distinctamount =
FILTER (
SUMMARIZE ( 'Table', 'Table'[Id], 'Table'[Amount] ),
'Table'[Id] = currentid
)
RETURN
SUMX ( distinctamount, 'Table'[Amount] )
 
 

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: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

 

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

amitchandak
Super User
Super User

@bml123 , Try a new measure like

 

sumx(summarize(Table, Table[ID], Table[Amount]),[Amount])

@amitchandak, I have tried your solution but it is not working.

@bml123 , if need a column, That was measure

Column = sumx(DISTINCT(SELECTCOLUMNS(filter('Table',[Id] =EARLIER('Table'[Id])),"Amt",[Amount])),[Amt])

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Kudoed Authors