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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
kasife
Helper V
Helper V

Distinct SUM

Hi Guys,

I would like to get the distinct sum by project and by module. I have a sales table with several lines, and when I add the value of the project, the result is multiplied. How could I do it?example:

kasife_1-1687026157015.png

 

Im using the following measure, but the result is incorrect:

SUMX ( DISTINCT (ultimoReaalDivulgado[VGV Venda] ), ultimoReaalDivulgado[VGV Venda] )

kasife_2-1687026287391.png

 

 

 

 

 

1 ACCEPTED SOLUTION
DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

try this measure:

 

Total sales = SUMX(DISTINCT('Table'[Module]),MAX('Table'[Sales Value]))
 
DOLEARY85_0-1687033704254.png

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

 
 

View solution in original post

10 REPLIES 10
Ahmedx
Super User
Super User

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

https://1drv.ms/u/s!AiUZ0Ws7G26RiHk-scKQgUfACrhQ?e=nqG9Z6

Screen Capture #1283.png

@Ahmedx thank you so much. it worked perfectly

DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

try this measure:

 

Total sales = SUMX(DISTINCT('Table'[Module]),MAX('Table'[Sales Value]))
 
DOLEARY85_0-1687033704254.png

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

 
 

Hi @DOLEARY85 the sum is incorret. 

Apologies i sent the wrong one, try this instead:

 

Total sales = SUMX(DISTINCT('Table'[Module]),FIRSTNONBLANK('Table'[Sales Value],0))
 
DOLEARY85_0-1687075510742.png

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Hello 

 

please can you advise how to add a filter to this formula please?

 

the formula is great but what if i wanted to do based on condition of another column e.eg Rag = "Red"

 

please can you advise

You could try this:
 
Total sales = CALCULATE(SUMX(DISTINCT('Table'[Module]),FIRSTNONBLANK('Table'[Sales Value],0)),'Table'[RAG]="Red")
 
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

@DOLEARY85 thank you so much. it worked perfectly

Hi,

Share the download link of the PBI file.


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

Hi @Ashish_Mathur 

The link 

https://ufile.io/lmi0l5jr

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.