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
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
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 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.